4 replies [Last post]
gautamz07
gautamz07's picture
Offline
Enthusiast
Last seen: 3 years 9 weeks ago
Timezone: GMT+5.5
Joined: 2014-04-24
Posts: 265
Points: 403

Was just reading an article HERE. so is the below formula.

desired px value / inherited px value = em value

(see the visual example in the article).

is the above a reliable example?

thank you.

Gautam.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 1 day 15 hours ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9743
Points: 3822

Don't know

I didn't look. That's not the right question, though. You should ask if it is necessary.

Set your base font size at the user's default size and use percentages or (preferably) ems from there. Over the years, I have concluded that fixed metrics, pixels, points or picas for example, have no place in defining font size. They are accessibility nightmares. Once you realize that, pixels simply don't matter.

Knowing the pixel size of, say, images does matter because you want to keep the native size where you can, and where you can't, use your image software to scale and crop.

//edit: OK, I found a moment to look at that page. Good advice there. However, it doesn't matter what the user's default pixel size is. Conversion is not needed nor desirable as it gets you thinking about your own display instead of the user's. ~g

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

gautamz07
gautamz07's picture
Offline
Enthusiast
Last seen: 3 years 9 weeks ago
Timezone: GMT+5.5
Joined: 2014-04-24
Posts: 265
Points: 403

Thanks gary

Thank you gary , just one more question(sorry to deviate from the real topic), have you moved to flex box layouts or do you still use float based layouts ? i know flexbox lacks support for critical browsers.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 1 day 15 hours ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9743
Points: 3822

Not either/or

I don't use flex simply because I'm not writing new pages. What work I do since retirement is debugging and minor maintenance. There will come a time when I will have to seriously dig into flex, but I'm old and tired. Sad

Don't forget the display property for controlling layout, e.g. table/table-cell or inline block. There are lots of ways to skin a cat with the old methods, too.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

gautamz07
gautamz07's picture
Offline
Enthusiast
Last seen: 3 years 9 weeks ago
Timezone: GMT+5.5
Joined: 2014-04-24
Posts: 265
Points: 403

Thanks for the advice gary

Thank you so much for the advice gary Laughing out loud . Happy Debugging .. i don't know how much fun that is though Tongue Thanks alot for you time. Ohh and Chrismas is coming up .. so wish you a very Happy chrismas and new year Laughing out loud Hope you have a good one.