Design comparison
Solution retrospective
That's my solution to this challenge. I'm a beginner and still learning HTML and CSS, but I'm open to comments and suggestions.
Community feedback
- @burrijwPosted over 1 year ago
Nice job! ππ» This is a really good start.
Here are some suggestions: Simplify your HTML. The simpler your markup, the easier your code will be to maintain. Keep it simple. All you need is this. ππ»
<body> <main class="card"> <img/> <h1>...</h1> <p>...</p> </main> </body>
- You donβt need a
<picture>
element in this case. Use that when you need to serve different image resolutions at different screen sizes, or when you need different images for artistic purposes. - Every webpage needs a
<main>
landmark. With something this simple, your whole card can be themain
, but in a larger site you'd have many many elements inside and themain
would contain everything except for aheader
andfooter
. You can read up on semantic HTML on web.dev.
Avoid using ID's for CSS selectors. They have a very high specificity and it's going to cause more problems than it is worth. Use classes to avoid βspecificity warsβ.
NEVER use
px
for fonts. Userem
or another responsive unit. You can read more on Grace's blog.Centering your card. There are some pretty simple ways of centering things in modern CSS. Here is the snippet I tend to use:
body { display: grid; place-content: center; min-block-size: 100vh; }
Some will prefer using flexbox, though it is technically more code:
body { display: flex; justify-content: center; align-items: center; min-block-size: 100vh; }
Some nitpicky things:
- The background color is off.
- The heading font is not the right size.
- You have some typoβs:
container
in your CSS andskills
in your markup.
Keep it up. You're off to a great start. :)
Marked as helpful0 - You donβt need a
- @0xabdulkhaliqPosted over 1 year ago
Hello there π. Congratulations on successfully completing the challenge! π
- I have other recommendations regarding your code that I believe will be of great interest to you.
HTML π·οΈ:
- This solution may cause accessibility errors due to lack of semantic markup, which causes lacking of landmark for a webpage and allows accessibility issues to screen readers, due to accessibility errors our website may not reach its intended audience, face legal consequences, and have poor search engine rankings, highlighting the importance of ensuring accessibility and avoiding errors.
- What is meant by landmark ?, They used to define major sections of your page instead of relying on generic elements like
<div>
or<span>
. They are use to provide a more precise detail of the structure of our webpage to the browser or screen readers
- For example:
- The
<main>
element should include all content directly related to the page's main idea, so there should only be one per page - The
<footer>
typically contains information about the author of the section, copyright data or links to related documents.
- The
- So resolve the issue by replacing the
<div id="container">
element with the proper semantic element<main>
in yourindex.html
file to improve accessibility and organization of your page
.
I hope you find this helpful π Above all, the solution you submitted is great !
Happy coding!
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