Design comparison
Solution retrospective
What would you use to replace the <br> as line breaks in CSS? can an image and text be centred more efficiently? how would it adapt to a mobile screen?
Community feedback
- @ciisiqPosted about 2 years ago
Hi Federico Bordini, well done! keep going 🙌🏻
body { display: flex; // for to use the flexbox flex-direction: column; //the default on flexbox will be in a row to put one under the other justify-content: center; //align the items on center on horizontal align-items: center; // align item in the vertical }
You can use flexbox to center things and break down the elements, here is a link: https://css-tricks.com/snippets/css/a-guide-to-flexbox/ if you like learning to play, I like this one: https://flexboxfroggy.com/
Have a nice code day!!
Marked as helpful0 - @amalkarimPosted about 2 years ago
Hi Federico. Congratulations on your first solution in Frontend Mentor!
Regarding your questions, here is my personal view.
Instead of using
<br>
as line breaks, to make text doesn't occupy the full width of its parent element, I personally will give the parent element the right amount of padding.To make image and text centered, you can use
display: flex;
ordisplay: grid;
. For example, in your code, instead of using this styling:main { text-align: center; margin-top: 10%; margin-left: 40%; padding: 1%; background-color: hsl(0, 0%, 100%); position: absolute; border-radius: 10%; }
give the
body
additional styling, and remove some ofmain
stylingbody { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; } main { text-align: center; background-color: hsl(0, 0%, 100%); border-radius: 10%; }
That would likely improve the result.
For other aspects of the design, feel free to check my solution.
Hope this helps!
Marked as helpful0
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