Design comparison
Solution retrospective
this is my project, i'm sure my css could be better. i tried using grid at some point but it was nightmare-ish to say the least. i don't know what i was doing wrong, but i'll try again with a different project. i can't place the attributions where i wanted to, if anyone could tell me why justify-content and align-items don't work at all that'd be cool.
is there anything i should do differently in the future? good habits to get? thanks in advance.
Community feedback
- @danielmrz-devPosted 11 months ago
Hello @megaiera!
Your solution looks great!
I have a couple of suggestions for improvement:
- In order to make your HTML code more semantic, and since that is the main title of the screen, replace the
<h2>
with<h1>
. 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/subject for the whole page. Also, do not skip heading levels - start with<h1>
, then use<h2>
, and so on.- Also, still about semantic HTML, replace your
div.main-container
withmain.main-container
.
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@megaieraPosted 11 months ago@danielmrz-dev Hi! thanks for the reply! i initially chose the <h2> tag because i thought it would make more sense on an actual website, where it wouldn't be the only preview card! i get why it might be/is wrong semantically ahah. thanks again, i'll change that.
1 - In order to make your HTML code more semantic, and since that is the main title of the screen, replace the
- @Abed001Posted 11 months ago
hello, I saw your comment and tried to see your code, since not everyone's coding is the same I tried my best. first, I added margin-top to attribution and it worked because i think there is something in the shadow may it taller I am not sure . second I added a hover state on the card and you should also add hover state on the .<h2><a href="/"> HTML & CSS foundations </a> </h2>. here is my added code:
.cardshadow{ box-shadow: 10px 10px rgba(0,0,0);
} .cardshadow:hover { box-shadow: 15px 15px rgba(0, 0, 0); /* Increase shadow size and opacity on hover */ } .attribution{ margin-top:50px; border:2px solid white; color: var(--Grey); font-size: 10px; word-spacing: 2px; }keep going
1@megaieraPosted 11 months ago@Abed001 thank you very much! you're right, i'll add the hover state to both!
1 - @cjdemillePosted 11 months ago
When you wrote out your reset css, you set the margin for all items to 0 (which is helpful for overwriting default styles) but in this case, that means there's no margin between your card and the attribution div.
You could choose to add a margin-top to your attribution div or a margin-bottom to your main-container div.
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