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

Article component

@Louisterryn

Desktop design screenshot for the Article preview component coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Hello everyone, I've finished the challenge and I think that everything works perfectly.

If you have any tips about how to optimize the code do not hesitate to tell me !

Have a great day

Community feedback

JK 345

@JakubKepak

Posted

Hi Louis, very nice work! 👌👏

In your code, you use px for size. I would maybe use some relative measure like rem or em. Also, I would fill in alt attributes for accessibility as the report suggests.

Anyway, I really like your solution. Keep it up! 🙌

0

@Louisterryn

Posted

Hello @JakubKepak , thank you very much ! I've heard about rem. I think I need to do html{font-size:62.5%} first so it's easier to use right ?

But what is better in using rem ?

0
JK 345

@JakubKepak

Posted

@Louisterryn default font size in many browsers is 16px. By setting html{font-size:62.5%} you say that it will be approx. 10px so it will be easier for you to calculate rem in your code. 1 rem = default size, in your case it 10px, 2rem = 20 px etc. If you have set it up like that, you can just easily set your html{font-size:50.0%} in your media query for instance and everything will be smaller but ratio stay the same.

0

@Louisterryn

Posted

@JakubKepak Oh ok I understand why it's nice now ! Thank you very much I'll use it on next projects :D

Have a great evening sir

0
JK 345

@JakubKepak

Posted

@Louisterryn You too! also found a quite good article about rem and em https://www.sitepoint.com/understanding-and-using-rem-units-in-css/

0
P
Grace 27,710

@grace-snow

Posted

Glad you got this sorted, it looks pretty good ☺

On the rem size thing, yes definitely use them, but (beware, minor rant coming, haha) I always advise against changing your root (html) font size to 62.5%.

That can lead to unintended consequences for people who need to zoom to see your site properly. All it takes is one default element that doesn't inherit font size from its parent - if you forget to bump the font size back up on that one element using your new rem calculation, you've broken the site for all those people.

We don't need to 'work with rems' or make manual calculations with them so there's no need to change the value from 100% on html IMO (usually equates to 16px).

I've yet to see a site that needed everything to be in divisible units of 10 in all my years, so there's really no need.

I have see it where base font size is bumped up to 112.5% (18px) but even that is only in certain circumstances, and much less likely to negatively impact the visually impaired.

So... My take is that the cons outweigh the pros on this one!

1
JK 345

@JakubKepak

Posted

@grace-snow Didn't think about this like that. Thank you for the comment.

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