centering by absolute positioning and transform, colors as variables
Design comparison
Solution retrospective
- is there an easier way of centering, especially vertically except with absolute positioning + translate and setting body to 100vh (as this is the anchor) like I did? I do not know JS so far. Maybe creating a huge flexbox over the whole page and putting inside the qr-container which can then been aligned with align-items?
- would it be better to put all the contents of the white container in an extra inner div together because of the required gap to the container border? I aligned all elements seperateley to the border.
- a shadow color was not predifined, so I hope it is ok to have modified the font color
- please tell me everything that could be done more elegantly, efficiently, thank you!
Community feedback
- @fernandolapazPosted over 1 year ago
Hi 👋, perhaps some of this may interest you:
HTML, ACCESSIBILITY:
- Every page should have an
<h1>
to improve user experience and because it is an important element when it comes to SEO. It is good not to skip heading levels.
CSS:
- The page content could be centered using Grid or Flexbox. For example as follows:
body { min-height: 100vh; display: grid; place-content: center; }
- And it is better to use
min-height: 100vh;
for the body, as usingheight
causes the page to be cut off in viewports with small height (such as mobile landscape orientation).
I hope you find it useful, any questions do not hesitate 🙂
Regards,
Marked as helpful0@cologniaPosted over 1 year ago@fernandolapaz
Hi Fer! Thank you so much for your comments! In this task there was no text/headertext which to insert as a <h>-tag right behind the main tag. In this case would you leave the <main> out? What do you do if your page does not start with a headertext ?
Thank you and hasta luego! ;)
0@fernandolapazPosted over 1 year ago@colognia
Hi! this is what I think:
The easiest thing to do would be to use <h1> instead of the <h3> you used.
An alternative would be to add a <header> before the <main> with the name of the challenge as <h1> for example (hiding it with CSS). And then use <h2> for the first sentence of the card (it's not good to skip headings).
Saludos! :)
0 - Every page should have an
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