Design comparison
Solution retrospective
Is there a easier 1 to 2 step way of spacing elements inside a container? I used a combination of margin and padding also with text align to place the element. I found once I have all my actual content into my browser, tweaking and customizing the element was trial and error until I came across a solution I liked,
Community feedback
- @miranleginPosted about 2 years ago
Hi Antonio,
first of all you can remove
height
property from probably anywhere in CSS, it is of no good use especially on images and image containers. You can also remove<div class="text">
. Next.container
can havedisplay: flex; flex-direction: column
so you can space elements inside him withrow-gap: [some-value]
. Also you could add somepadding
on the.container
itself to make some room for elements inside it.Keep coding!
0 - @denieldenPosted about 2 years ago
Hi Antonio, congratulations on completing the challenge, great job! 😁
Some little tips for optimizing your code:
- add
main
tag and wrap the card for improve the Accessibility - also you can use
article
tag instead of a simplediv
to the container card for improve the Accessibility img
element must have analt
attribute, it's very important!- remove all unnecessary code, the less you write the better as well as being clearer: for example the
div
container of image - remove all
margin
fromcontainer
class - use flexbox to the body to center the card. Read here -> best flex guide
- after, add
min-height: 100vh
to body because Flexbox aligns child items to the size of the parent container - instead of using
px
use relative units of measurement likerem
-> read here
Hope this help! Happy coding 😉
0 - add
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