Design comparison
Solution retrospective
Do you have any questions about best practices? --->what is the best way to use #id ?, I use class most of the time. and is margin padding setting to 0, a good practice and box-sizing to border-box
Community feedback
- @danielmrz-devPosted 10 months ago
Hello @vishalpankhade!
Your solution looks great!
I have a couple of suggestions for improvement:
- First: In order to make your HTML code more semantic, use
<h1>
for the main title instead of<div>
. Unlike what most people think, it's not just about the size and weight of the text.
π The
<h1>
to<h6>
tags are used to define HTML headings.π
<h1>
defines the most important heading.π
<h6>
defines the least important heading.π Only use one
<h1>
per page - this should represent the main heading/title for the whole page. And don't skip heading levels - start with<h1>
, then use<h2>
, and so on.- Second: Still about semantic HTML, use
<main>
to wrap the main content instead of<div>
.
All these tag changes may have little or no visual impact but they make your HTML code more semantic and improve SEO optimization as well as the accessibility of your project.
I hope it helps!
Other than that, great job!
1@vishalpankhadePosted 10 months agothank you, @danielmrz-dev for your valuable suggestions, I will keep those in mind and make changes.
1 - First: In order to make your HTML code more semantic, use
- @rayaattaPosted 10 months ago
I forgot,it is better to use
ID
s fo anchoring purposes then classes for css and js stuff. Checkout this amazing article that explains it all what the id attribute is for0@vishalpankhadePosted 10 months agothanks, @rayaatta, for sharing this article, I will look into it.
1 - @rayaattaPosted 10 months ago
Hello VISHAL_PANKHADEπ, Congratulations on completing this challenge π
To answer your questions. Setting
padding:0; margin:0;
On the universal selector prevents unexpected results due to default padding and margins by the browser.
2 Setting
box-sizing: border-box;
is a big plus since you can size items and end up with the actual sizes you declared If you don't declare box-sizing to border-box the browser uses the default which is content box.imagine you set your div towidth:100%
but you give it some padding inside.it Will overflow its container because it was given a100% width excluding padding and margins.I hope this helps π
If you need any more clarity don't hesitate to ask.
Your solution looks awesome
0 - @iRaYzEnPosted 10 months ago
hay, yeah you should always reset the default behavior with css ,
and it doesn't matter to use classes or ids you can use whatever you want for now
btw checkout naming convention called BEM use it to name things better
and you are using a lot of divs to represent paragraphs you should use the <p></p> tag insteadhope you the best
0@vishalpankhadePosted 10 months agothanks @iRaYzEn for suggesting BEM I will try that, actually I didn't get that always reset the default behaviour with CSS, what does that mean?
1@iRaYzEnPosted 10 months ago@vishalpankhade, reset the default behaviour, like reset the padding, the margin, and the box-sizing, and much more you can checkout this modern css reset by the one and only ANDY
you can copy it and past in the other file and link it with html https://andy-bell.co.uk/a-modern-css-reset/ kevin powell approved btw
and go ahead and learn a little bit of js you will find your self enjoying the development process more
happy codding
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