Design comparison
Solution retrospective
Tried my best, hope to get some feedback
Community feedback
- @FluffyKasPosted over 2 years ago
Hey,
This component is so small it's kinda cute >.< Now, to give some constructive feedback as well:
-
To center a component, you could add this to the <body>:
display: grid
,place-items: center
,min-height: 100vh
(height here is needed for vertical alignment). If you prefer, you could use flexbox instead, it works just as well. -
You could increase the
width
of your box. By usingmax-width
you can make it responsive, although it's not really required for this challenge. Defining height usually isn't needed (the above mentioned min-height is an exception that you'll rarely need to use, unless you're centering a solo component). All html elements have a default height, so it's best not to overwrite them, as that in best case does nothing (like this case here) or in worst case can cause an overflow. If you'd like to increase height, you could add padding instead. -
align-items
andjustify-content
properties only work with grid or flexbox but not withdisplay: block
. -
You can add
max-width: 100
andheight: auto
to your images to make sure they resize for all screens while keeping the original aspect-ratio. -
To define padding you can use the
padding
shorthand. So for the "opacity" div you could gopadding: 0 1rem 1rem 1rem
instead of the 4 lines of code you wrote. -
There's no need to wrap the text and the title in divs, they do just fine without.
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