Design comparison
Solution retrospective
Feedback are welcome
Community feedback
- @ecemgoPosted over 1 year ago
Some recommendations regarding your code that could be of interest to you.
- In order to center the card correctly, you'd better add flexbox and
min-height: 100vh
to thebody
- For the color of the screen, you can use the recommended color in the
body
body { /* background-color: hsl(220, 15%, 80%); */ background-color: hsl(212, 45%, 89%); display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100vh; }
- If you use flexbox in the
body
, you don't need to use flexbox andmargin
in the.container
to center the card - If you use
max-width
instead ofwidth
, the card will be responsive - You'd better give specific
padding
instead ofauto
and reduce the width of the card
.container { background-color: white; /* display: flex; */ /* flex-direction: column; */ /* width: 350px; */ max-width: 300px; /* margin: 3.5rem auto; */ /* padding: auto; */ padding: 15px; /* align-items: center; */ border-radius: 0.5rem; }
- In addition to that above, in order to make the card responsive and the image positioned completely on the card, you'd better add
width: 100%
anddisplay: block
for the img in this way:
img { /* width: 330px; */ width: 100%; display: block; /* margin-top: 10px; */ border-radius: 0.5rem; }
- Finally, if you update your code like the above, the card will be responsive so you don't need to use media queries for this solution. You can delete it.
Hope I am helpful. :)
Marked as helpful1@jhkuahPosted over 1 year ago@ecemgo Thanks so much for the feedback! I'm able to reduce the amount of lines in my CSS file, but may I know how why
display: block
andwidth : 100%
is being used or how it helps to stay in position within the card?EDIT: I found my answer, just to make sure I understand,
width : 100%
takes up the full width of my parent container, which is.container
, and because I have set in.container
withpadding: 15px
, it looks centered?1@ecemgoPosted over 1 year ago@jhkuah definitely, that is right👍by the way, it's important to clean the code and I'm happy to help 🤗
0 - In order to center the card correctly, you'd better add flexbox and
- @pperdanaPosted over 1 year ago
Hello there 👋. Congratulations on successfully completing the challenge! 🎉
- I have some additional recommendations for your code that I think you'll find interesting and valuable.
📌 Add
<footer>
tag as semantic HTML in code-
The
<footer>
tag is another semantic HTML element that is used to define the footer section of a web page. -
The
<footer>
tag should be used to wrap the content that appears at the bottom of a web page, such as copyright notices, contact information, or links to other pages.
for example code:
<footer class="attribution"> Challenge by <a href="https://www.frontendmentor.io?ref=challenge" target="_blank">Frontend Mentor</a>. ................................. </footer>
In the example above, the <footer> tag is used to wrap the copyright notice, which is the content that appears at the bottom of the web page. This tells both human readers and search engines that the content inside the <footer> tag is the footer section of the web page.
I hope you found this helpful!
Happy coding🤖
0
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