Design comparison
Solution retrospective
I found putting some spacing between text and card a bit challenging so I hope anyone can help. also any feedback would be great since i'm still a beginner
Community feedback
- @orphandeityPosted over 1 year ago
Wow, your project looks great!
Looking at your code, I think you would benefit a lot from using responsive units like em and rem. These units are based on the font-size and will help keep things consistent and prevent you from having to think with pixel-perfect precision. They are used in place of px and are great to use for margin, padding & font-size. When you are first learning about these units, I would start with and focus on rem and then use em when you need more control.
There are also responsive units that are based on the window size... these are vh and vw. To illustrate, 100vh is equal to the entire height of the window and would effectively make the element fullscreen. 50vh would make the element take up half the window and vw does the same thing for width.
Here is a really good article on the subject of viewport units.
Marked as helpful1@alihaydar28Posted over 1 year ago@orphandeity thanks for taking the time to reply. Sure i will look into the stuff you mentioned !
0 - @HassiaiPosted over 1 year ago
Replace <div class="card"> with the main tag to fix the accessibility issues. click here for more on web-accessibility and semantic html
There is no need for the <br> in the html. there is no need to give the html and the bosy a width and heigh value.
To center .card on the page using flexbox, add min-height : 100vh to the body.
For a responsive content, give .card a max-width value and increase the padding value.
max-width: 320px padding: 16px
.Give the img a max-width of 100% instead of a width for a responsive image. This challenge does not require a box-shadow.
Give .text a margin value for all the sides, text-align: center and a font-size of 15px which is 0.9375rem, this will be the font-size of both p and h1.
Use relative units like rem or em as unit for the padding, margin, width values and preferably rem for the font-size values, instead of using px which is an absolute unit. For more on CSS units Click here
Hope am helpful.
Well done for completing this challenge. HAPPY CODING
Marked as helpful1@alihaydar28Posted over 1 year ago@Hassiai thanks for taking the time to reply. Sure i will look into the stuff you mentioned !
0 - @jrleijnsePosted over 1 year ago
Hey there! Great job completing your first challenge! 🎊
I have some suggestions for your code that might interest you.
HTML 📄:
- Instead of using the
<div>
tag for your containers, try using some semantic HTML to provide more meaning to it, for better SEO. For example, instead of using<div>
you could use the<main>
or<section>
tag. For the element with the classname attribution you could use the<footer>
tag. - If an
<img>
like in this case the QR-code, leads to a website or links to someplace else, try to provide a more descriptive text of that in yourALT
text, for example: QR code that leads to frontendmentor.io
CSS 🎨:
- Removing the margin-top from the
<h1>
element and removing all margin from the<p>
element and then adding some padding to the<div class="text">
should fix your issue. - To make your project more responsive and adaptable (in this case as well: especially when you start building bigger and bigger projects), I would suggest to use rem instead of px. This basically means that all sizing will be calculated in relation to the root element (rem). To set the standard font-size for the root element, you can provide a font-size inside the HTML element inside your CSS. For example:
html {font-size: 15px;}
.
For more information on this topic, you can read the following article: PX or REM in CSS? 📘
- To make your solution responsive for different devices and screen widths, you can create a media query inside your CSS file and set the breaking point (i.e. the moment your media query gets triggered based on the width of the viewport). For example:
@media (max-width: 375px) { ***Place your CSS code here, just like you would in a regular CSS file***}
.
For more information on this topic, you can read the following article: Media queries 📘
- An easy way to quickly and automatically center your
<main>
element inside the<body>
of your page, is by setting the following properties onto the<body>
element inside your CSS like so:body { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; }
I hope you find my suggestions useful, and above all: the solution you provided is very good!
Keep it up and happy coding! 😃
Marked as helpful1@alihaydar28Posted over 1 year ago@jrleijnse thanks for taking the time to reply. Sure i will look into the stuff you mentioned !
1 - Instead of using the
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord