Hacker News new | ask | show | jobs
by JoshTriplett 5455 days ago
First, please don't ever do something like "* { font-size: 75%; }" ; that literally means "take whatever readable font size the user's browser wants to use and shrink it by 25%". In other words, it means I'll almost certainly hit Ctrl-+ until the font grows back to 100% and the rest of your page will scale accordingly.

Second, I can easily tell you exactly what size h1 is: 25% bigger than the rest of the text on the page. If you're just going to start by assuming the browser has a given point size by default, and fill in percentages that result in exactly the point sizes you think the user ought to see, you're not really thinking in relative sizes, and you might as well use absolute sizes.

What method do you want to use to determine the font-size of h1? Presumably you have some idea in mind for how it should contrast with regular text. Try to answer that question without actually knowing the exact point size of the rest of the page text. If you can, then use that relative size in your CSS. If you can't, then perhaps browsers need more capable CSS so you can express what you want. :)

1 comments

I agree. I gave that code as an example of a bad idea. For me, "If you can, then use that relative size in your CSS", has never been an option. Ems also have the same sizing problems regarding not knowing the browser's base text size.

I'm sticking with the quite capable pixel unit for the foreseeable future. :)