Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

responsive page

Willian Padilha• 40

@Williais

Desktop design screenshot for the QR code component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


I'm starting in css and what I felt the most difficulty with was centering the div.

Community feedback

Aimal Khan• 2,260

@Aimal-125

Posted

Bro use position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); Or display: flex; justify-content: center; align-items: center;

Marked as helpful

0
Moses Ventura• 170

@Moses2308

Posted

Hello, Knowing you're starting out with css is helpful context for this project. There are a couple of things to note about your project.

TLDR

For further development look into the following topics: CSS BEM, Responsive Design, Relative and absolute units, and Semantic HTML.

HTML

  1. Like the previous commenter mentioned, you should be using the MAIN element to encapsulate your pages main content. For further development, I would recommend you research the topic of Semantic HTML. You will often be using elements like main, nav, article, main, and footer in your projects.
  2. You shouldn't use Heading elements for size. This is a mistake many people starting can make. Headings should be used for document structure.

CSS

  1. I can see why you imported a charset in your stylesheet, but its more common to link to the Google Fonts from the HTML. To do this you would copy the <link> code from google fonts and paste it into your HTML's head.
  2. As you develop in your journey, you'll find that using px for certain things becomes less common. I would recommend looking into relative and absolute units. For text it is more common to use rem.
  3. The previous comment referred to never using a height. Generally speaking, you should avoid using height, but if you absolutely have to, then it's recommended to use min-height. The reason for this is that setting a specific height can cause issues with responsiveness.
  4. It isn't an issue yet, as this is a fairly small project, but going forward I would recommend using classes more often. Selecting things by element can cause issues later on. To avoid this we often select things by their classes and then with a combinator we specify further if we need to. I would recommend picking a CSS naming convention to start getting familiar with it. I take inspiration from the BEM naming convention.

Resources

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements https://www.youtube.com/channel/UCJZv4d5rbIKd4QHMPkcABCw https://developers.google.com/fonts/docs/getting_started https://css-tricks.com/bem-101/

Marked as helpful

0
hitmorecode• 6,230

@hitmorecode

Posted

Congratulations on your effort well done. Here are a few changes you can do

  • Change your html structure to this
<body>
<main>
<div>
place your content in here
</div>
</main>
</body>
  • To center the div you were almost there, you just need to add two things in your CSS
body{
display: flex; 
width: 100%; /* you don't need this, remove it */
height: 100%; /* change it to min-height: 100vh. this will place your card in the middle of the page */
background-color: #d5e1ef;
justify-content: center;
align-items: center;
}

div{
background-color: white;
width: 280px;
height: 450px;
margin-top: 10%; /* because the card is already positioned with flexbox, you don't need this. Remove this line, this line causes other problem. when going to small screen size, the card will move upwards */
border-radius: 20px;
box-shadow: 0 6px 10px rgba(128, 128, 128, 0.219);
text-align: center;
}

/* You defined the same font-family in two different places. You don't have to do this, just place the font-family on the body and it will apply for the entire page */
div h2{
font-family: 'Outfit', sans-serif;
font-size: 16px;
font-weight: bold;
color: #1d2a4a;
padding: 0px 30px 0 30px;
}

div p{
color: gray;
padding: 0px 30px 0px 30px;
font-size: 14px;
font-family: 'Outfit', sans-serif;
}

One more tip, for this challenge is not that important due to the size of the content. For next challenges try to use more classes and / or id's. When the markup gets larger it will be hard to just style a div with css. If you have multiple layers of div's it will be more work to style them with css.

Keep it up 👊

Marked as helpful

0
Joachim• 840

@Thewatcher13

Posted

Hi

I've a few things to say:

html

  • use a main landmark role
  • dont skip the heading order you cant have an h2 before h1
  • your alt on the img should be much more clear a qr code to where?

css

  • There is no need to import a charset in your css..why did you do this?
  • dont use px for font sizes , but rem, look at the post from fedmentor called "why you should never use px for font size"
  • never set a height on a container the content provides the height

Marked as helpful

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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