Design comparison
Solution retrospective
-
I am not sure about how to approach to margins and padding just by looking at the final result, in this case I adjusted values by hit and error method. But I don't think this is the right way to approach.
-
Struggled in bringing a div at the center of screen , I have to study the position topic again.
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 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="parentdiv">
element with the proper semantic element<main>
along with<div class="attribution">
into a<footer>
element 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!
1@Vivek13130Posted 7 months agothanks a lot sir , i never heard about these things , i will study them now :) <3@0xabdulkhalid
0 - @ifcoder1Posted over 1 year ago
I'll try to answer in a way that'll make sense.
Firstly to center your content, set your body's width to 100% and set your height to 100vh so the body's height can go from the top of your screen to the bottom of your screen. I would research css 'vh' to get a better understanding of its purpose. Then you want to set your body's display property to flex. Example: body { display: flex }. Afterwards, use justify content: center to center your content horizontally and use align-items to center your content vertically (setting your body's height to 100vh makes this process go smoothly). Lastly, you want to make sure you get rid of padding and margin by using the universal selector and setting margin and padding to 0. Example: * { margin: 0; padding: 0;}.
As for your approach to margining and padding up your content. You want to make sure you have all your content laid out first. So don't leave out any images or text that is needed to complete your project. To use padding in this project you would set your parent containers padding because padding spaces out the INNER content away from the content's BORDER. Your Inner content being your image, heading, paragraph. You can use margin to add space to elements. Watch some videos on padding and margin to get a better understanding. A way to think about it is, every element in HTML is a box. Here's a video for an explanation of CSS box model. Try to understand this as it'll help you understand what I'm saying better: https://www.khanacademy.org/computing/computer-programming/html-css/css-layout-properties/pt/css-box-model
Sorry if I'm not so clear with my feedback. Not good at explaining things through text versus in person. I hope this helps in some way.
0@Vivek13130Posted 7 months agothanks a lot for the detailed answer, helped a lot @ifcoder1
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