Design comparison
Solution retrospective
This is my first time creating something with HTML and CSS. Any advice on best practices is appreciated.
I struggle with understanding how to use layouts more effectively, hence why "px" is used a lot when positioning elements.
I am also unsure if I am using CSS selectors correctly with the div tag.
Community feedback
- @faha1999Posted about 2 years ago
Hello, aljacly Congratulations on finishing this project. It's lovely and great on the whole! Just a little tip:
- You might want to use semantic tags like the
<main>
to wrap your code, instead ofdiv
s. like
<main class="container"> <div></div> <div></div> <div></div> <div></div> </main>
This would help improve accessibility.
- add the below code to the body. It will center everything
body { justify-content: center; align-items: center; display: flex; height: 100vh; flex-direction: column; }
- remove the below styles from the
.border
.border { /* width: 200px; */ /* height: 200px; */ /* display: block; */ /* margin-left: auto; */ /* margin-right: auto;*/ /* margin-top: 250px;*/ }
- remove the below styles from the
.caption
.caption{ /* top: 48%;*/ /*height: 200px;*/ margin-top: 5rem; }
I hope it will work. Happy coding.
Marked as helpful2@aljaclyPosted about 2 years ago@faha1999 Thanks very much for the tips and for sharing your solution! I appreciate the breakdown of the code.
0 - You might want to use semantic tags like the
- @correlucasPosted about 2 years ago
👾Hi @aljacly congratulations on your first solution!👋 Welcome to the Frontend Mentor Coding Community!
Great solution and a great start! From what I saw you’re on the right track. I’ve few suggestions for you that you can consider adding to your code:
This article explain why is better to use
rem
overpx
:Some people, for example, need to zoom maybe up to 400% to be able to read your text, due to a visual impairment. Using REM you make sure that your text respects these needs, because the font-size is defined relative to the default font-size a user has chosen.https://www.freecodecamp.org/news/what-is-rem-in-css/#:~:text=Using%20REM%20(or%20another%20relative,due%20to%20a%20visual%20impairment.
✌️ I hope this helps you and happy coding!
Marked as helpful1@aljaclyPosted about 2 years ago@correlucas thank you for the help! was exactly what I was looking for.
0 - @ayobanjoPosted about 2 years ago
Hello Aljacly, I just submitted this myself, few observations though #CSS
- You should create a CSS file to make your HTML file cleaner
- You should use flex on your body tag to centre its children(main or the div containing the code)
- The div class border is breaking the code. You should remove it once the flex is added
#HTML
- Your text should be in a paragraph tag, or heading tag, not in a div
Hopefully, I have been of help. Still a lot to be done though
Marked as helpful1@aljaclyPosted about 2 years ago@ayobanjo Thanks so much for your help! I haven't used flex before, so will look into that.
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