Design comparison
Solution retrospective
Hello! First time using this challenge site. Everything was pretty smooth, although I feel like I used a bit too much CSS for such a small project. Lastly, I had a little problem with perfectly centring the card component and just gave it a padding-top.
Feel free to comment on the solution, especially with suggestions on how to reduce the code size and perfectly centre the component.
Community feedback
- @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 generates accessibility error reports, "All page content should be contained by landmarks" is due to
non-semantic
markup, which causes lacking of landmark for a webpage
- So fix it by replacing the
<div class="cardcont">
element with the semantic element<main>
along with your<div class="attribution">
with a<footer>
element in yourindex.html
file to improve accessibility and organization of your page.
- 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
- They convey the structure of your page. 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
HEADINGS ⚠️:
- And, this solution has also generated accessibility error report due to lack of level-one heading
<h1>
- Every site must want at least one
h1
element identifying and describing the main content of the page.
- An
h1
heading provides an important navigation point for users of assistive technologies, allowing them to easily find the main content of the page.
- So we want to add a level-one heading to improve accessibility by reading aloud the heading by screen readers, you can achieve this by adding a
sr-only
class to hide it from visual users (it will be useful for visually impaired users)
.
I hope you find this helpful 😄 Above all, the solution you submitted is great !
Happy coding!
Marked as helpful2@michaelo-oPosted over 1 year ago@0xAbdulKhalid Thanks for the review. I implemented your suggestions and after generating a new accessibility report, there were no issues detected.
0 - @ecemgoPosted over 1 year ago
Some recommendations regarding your code that could be of interest to you.
-
In order to fix the accessibility issues, you need to replace
<div class="cardcont">
with the<main>
tag and<div class="attribution">
with the<footer>
tag. :) You'd better use Semantic HTML, and you can also reach more information about it from Semantic HTML and Using Semantic HTML Tags Correctly. -
Also, each main content needs to start with an h1 element, and also contain only one h1 element. Your accessibility report states the need for one main landmark. So, you need to use a
<h1>
element in the<main>
tag instead of using<p>
. You can replace your<p class="l1">Improve your front-end skills by building projects</p>
element with the<h1 class="l1">Improve your front-end skills by building projects</h1>
element.
Hope I am helpful. :)
Marked as helpful1@michaelo-oPosted over 1 year ago@ecemgo Thank you for the review. And yes, you were very helpful :)
1@michaelo-oPosted over 1 year ago@ecemgo I just completed another challenge a few minutes ago. Your review of it would be well appreciated. 🙇🏽♂️
1 -
- @kabir-afkPosted over 1 year ago
Hey You've done a great job but there are some things you should definetely try out to code efficiently. Using pixels for everything can be exhausting . You can try using ems for padding and margin , rem for font size and % s for defining widths. Try avoiding heights as much as possible...as you are using flexbox (which automatically translates to flexible-box), you can avoid heights...as flexbox's height will self-determine itslef based on the contents present inside itslef. Keep coding , you'll get there broo ! !
Marked as helpful1@michaelo-oPosted over 1 year ago@kabir-afk Thanks, but I have a question.
When converting from pixels to em and rem values, it usually gives the same answer.
If so, would it not be better to just use em values all through?
0@kabir-afkPosted over 1 year ago@m1chae-l Well no, good question btw... you see em and rem are relative units., that is why they are often used...we use such relative units to make our life easier. The reason we can't use em throughout is because ems keep stacking on top of one another. For example:-
body{font-size:1em;}
main{font-size:2em;}
Let us say you write "hello world" in body . . you'll get a font with size 1em , that's perfectly fine , but when you write the same thing under main you'll get a font-size that's bigger than 1 or 2em.. this is where rem comes in..no matter where you use them they'll always maintain their size , just like pixels , a fixed size you may say, but since they are easier to work with , they often go hand-in-hand with font-size. Font is something you'll need a fixed size of, I mean kind-of....but if we talk about padding and margin , these are few things that can't be always fixed. When you go from larger viewports to smaller ones , you wouldn't want to have the same
padding-top:75px
or (whatever)Instead you would want something that changes in relation to our desired viewport while maintaining our design...when you use pixels you are nailing the dimensions into screen...try giving your div tag a fixed width of , let us say 200px, same goes for height ,then switch to responsive mode. You'll see that it doesn't really change much,(that's why I recommended %) , same can be said for font size or any other value, now again you use media queries to adjust that , but why would you make it difficult for yourself than it already is...to get detailed info about ems and rems you can look into kevin powell's YT channel...Happy Coding!!!!
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