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

Four Card Feature - CSS Grid

P
Marcus 110

@marcus-hill

Desktop design screenshot for the Four card feature section coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


What are you most proud of, and what would you do differently next time?

Proud of my use of the CSS grid, which I only learnt an hour before embarking on this project. I worked out the number of rows and columns needed beforehand in order to meet the design, which looks pretty accurate now.

What challenges did you encounter, and how did you overcome them?

Initially had challenges centering both the top part and the blocks on the page using CSS grid, with them slightly to the left and right, however flexbox worked.

What specific areas of your project would you like help with?

I would like someone to check over my CSS grid usage and check it is as responsive as possible, matching the brief.

Community feedback

P

@kaamiik

Posted

Hi. Congratulation for doing this challenge.

I think Your html is good. For your heading, I suggest using max-width instead of using br tag.

Your images are decorative and do not need alt text.

For your line-height I see using it without unit. If you divide your line-height value to your font-size, It is mostly between 1.1 (for headings) to 1.7 (for body).

Marked as helpful

0

P
Marcus 110

@marcus-hill

Posted

Hi @kaamiik , thanks for reviewing my solution. I've removed the br element and added a max width (different for both desktop and mobile) which has worked. I've also removed the alt tags from the images and added the rem unit where it was missing on one of the line-height elements.

Thanks again!

1
P

@kaamiik

Posted

Great! @marcus-hill

For the line-height you don't need any unit. This is the MDN definition for using it without any unit:

" The used value is this unitless <number> multiplied by the element's font size. The computed value is the same as the specified <number>. In most cases this is the preferred way to set line-height with no unexpected results in case of inheritance. "

So If your font-size is 16px and line-height with no unit is 1.5, then your line-height in px is:

16 * 1.5 = 24px;

Inside your design file sometimes they mention the line-height in pixel and you can easily convert it to unitless. But If they don't, usually It's 1.5 for body and 1.1 for headings. As I see you did this: line-height: 1.5rem; You have to delete the rem here and also use 1.1 for your headings.

0
P
Marcus 110

@marcus-hill

Posted

Hi @kaamiik ,

This makes sense now! Thanks a lot for explaining it. I was using rem in a similar way to how it should have been done with the unitless version then, so for the one with rem I have just deleted the rem and adjusted the others so they are multiplied by the font size to make the desired line height.

I will bear this in mind for the future!

1

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