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

Blog Preview Card

P

@flaviocmb

Desktop design screenshot for the Blog preview card coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


While you develop the card, you will notice the height is not matching. Then you realize that the line-height is important to fill it.

The size of the card for mobile

max-width: 75px; max-height: 26px;

and desktop

max-width: 82px; max-height: 30px;

The title, the tag and the avatar name are using

font-family: 'Figtree-ExtraBold';

The image must have

object-fit: cover;

Community feedback

T
Grace 29,310

@grace-snow

Posted

Hi, I hope this feedback helps

  1. never have text in spans or divs alone, use meaningful elements like paragraphs
  2. this is missing it's heading element
  3. it is really bad for performance to use css imports as you are doing now. Thats forcing the browser to start downloading an asset, then have to go looking for another one, then another one, then... Etc. If you want to break css down into partials, use scss instead.
  4. always use a modern css reset at the start of the styles. Look them up
  5. NEVER ever write font size in px. That's extremely important. That one line of css immediately makes your site inaccessible. Line height must also never be in px. https://fedmentor.dev/posts/font-size-px/
  6. you will never want to use 100vw anywhere. That can only cause overflow bugs. Viewport units don't account for scrollbars, so 100vw actually means "full width PLUS the width of a scrollbar", often resulting in horizontal scroll which you won't want. The body is already full width by default so there is no need
  7. instead of height 100vh on the body use min-height so it can extend beyond that limit when needed
  8. don't position the footer absolutely. It is overlapping other content on my phone. Let it sit below your component
  9. there is no need for whitespace no wrap on the footer. Once the font sizing is fixed all that will do is cause bugs
  10. on the component set max width in rem not px so it is properly responsive for all users no matter their font size
  11. on the component do not set a max height or height at all. This is very important. Never limit the height of text containing elements. If I change my font size or a content editor changes the about of text the card will break if it's had it's height limited like that. Never do it. Let the browser do it's job and decide the height as needed
  12. there shouldn't be any other widths or heights or even max widths in this either. The css reset would set img elements to display block and max-width 100%. The only other width or height you'd need in this is on the avatar image.
  13. there is an anchor tag missing in this card if it is meant to be clickable. Never set cursor pointer to anything that isn't interactive. You need to use the correct elements. If you want to make the whole card clickable look up the "inclusive components" site and there is a good post about how to do that

Marked as helpful

0

P

@flaviocmb

Posted

@grace-snow

Thank you so much Grace. I will try my best to address all 13 issues. Can I send you a message after that? (i don't even know if I can message back)

1
P

@flaviocmb

Posted

@grace-snow

Learned a lot from all 13 issues.

About the issue #9. nowrap is used to prevent breakdown whitespaces between names. Example <span class="s-nowrap">Flávio César Bezerra</span>

About the issue #12. I am pretty sure that the aspect-ratio is wrong from the design of Frontend Mentor. The code below should run smoothly in any settings of screens and/or fonts.

img { object-fit: cover; border-radius: 10px; width: 100%; /* width: 279px */ height: 12.5rem; /* height: 200px */ }

@media screen and (min-width: [as you wish]) { img { width: 100%; /* 336px */ height: auto; /* 201px */ } }

I will leave this very important article about img convention from MDN

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