Design comparison
Solution retrospective
I really have a big problem in position the text in the same line with images that's why i am not sure in my code especially in the areas where there are a text and a picture in front of it . So if there are some resources or practices to learn more in this subject please let me know and thanks.
Community feedback
- @denieldenPosted over 2 years ago
Hey Hafsa, congratulations on completing the challenge! You did a great job π
Let me give you some little tips for optimizing your code:
- add
main
tag and wrap the card for improve the Accessibility img
element must have analt
attribute, it's very important!- to make it look as close to the design as possible add
opacity: 1
toequilibrium:hover .img-active
class and usergba
for the cyan background in the.img-active
class - remove all
margin
fromcard
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 π
Marked as helpful2@hafsabnPosted over 2 years ago@denielden I really appreciate the reviews you gave, thank you
1 - add
- @terremotoBCNPosted over 2 years ago
well done, I help you with some tips:
The first thing is to place the card component in the center with the body height settings and the flex box css layout:
body { background-color:hsl(217, 54%, 11%); margin: auto; /* eliminate body margins */ min-height: 100vh; /* set 100% height to the viewport */ display: flex; /* set flex box to center the card*/ }
About your question, the best way to "position the text in the same line with images" is skip to use
floats
, use it only to fluid the text body arround an image.The best way to align text is to use
vertical-align
css property and set it in themiddle
, :/* For SVG icons */ svg, .card-icon { vertical-align: middle; /* Set vertical align in middle */ } /* For the Avatar image - quit float property */ .avatar { width: 12%; border: 1.5px solid white; border-radius: 50%; /* float: left; */ /* Dont use FLOAT */ vertical-align: middle; /* Set vertical align in middle */ }
I hope this helps you to improve
I propose U to practice the Flex Box layout with : flexboxfroggy
Marked as helpful1@hafsabnPosted over 2 years ago@terremotoBCN thank you for all your feedbacks it's really soo helpful
0@terremotoBCNPosted over 2 years ago@hafsabn U R Welcome!! Are you ready for new challenges?
0 - @MariusHorPosted over 2 years ago
Hi,
I would suggest that you start learning about Flexbox and Grid in order to gain some knowledge on how to position certain elements where you want them. You can check you Kevin Powell videos on this subject as they are beginner friendly and very easy to follow. I would also advise against using
text-align: justify
because it will make the spacing between words look off.Happy learning! π
Marked as helpful1 - @steeven509Posted over 2 years ago
Hi, I have not checked your source code yet but the report indicates that you have a lot of accessibility problem, if this feedback has helped you mark it as util thanks you
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