Closed Bug 912493 Opened 11 years ago Closed 9 years ago

rem units are relative to the font size after minimum font size preference is applied

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 816948

People

(Reporter: anandogc, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0 (Beta/Release)
Build ID: 20130803192641

Steps to reproduce:

Create a simple web page:

<html>
<head>
<style>
html {
	font-size: 10px;
}
</style>
</head>
<body>
<p style="font-size:3.5rem">abcd</p>
</body>
</html>


Actual results:

When the font-size in html is reduced (anything lower than 10px), the visual size of paraghaph does not change. 

When the font-size in html is increased (anything greater than 10px), the visual size of paraghaph increases. 


Expected results:

When the font-size in html is reduced (anything lower than 10px), the visual size of paraghaph should have reduced.
I can't reproduce this problem.  Please make sure you didn't set a minimum font size in preferences?
I still believe this is somehow a unwanted behaviour. Setting a minimum font-size is done intending to actually being able to read the text. 
When I set the font-size of the html-element in css to 5px (e.g. in a media-query for small devices) but set the body-element to 2.3rem then the calculated font-size is bigger then 10px. Minimum font-sizes should only affect the font-size that is actually calculated but it should not affect the calculation itself. On Ubuntu 15.04 the minimum-font-size is set to 10px as default. Many users might have no idea about that setting. Setting relative font-sizes based on a html-font-size of 62.5% or 10px is quite common. A lot of users will have no idea what is going on when they hit on such a page.
Was the problem you reported actually caused by a minimum font size?

(Trying to make sure we don't have two separate bug reports here.)
Flags: needinfo?(anandogc)
Apparently the problem was indeed caused by minimum font size.
On Ubuntu 14.04 with Firefox 37, I'm not getting this problem.
In this the default minimum font size is set to None.
When I'm setting the minimum font size to be 10px in preferences, I'm getting the same effect as I got originally.

Thank you.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Flags: needinfo?(anandogc)
Resolution: --- → WORKSFORME
WORKSFORME is for a bug that is no longer reproducable, which isn't the case here.

I think the current behavior is the behavior we want, though, as long as there isn't a substantial amount of Web content depending on other behavior.
OS: Linux → All
Hardware: x86_64 → All
Resolution: WORKSFORME → INVALID
Summary: rem doesn't work for font-size less than 10px → rem units are relative to the font size after minimum font size preference is applied
Version: 23 Branch → Trunk
There is a substantial amount of Web content where this problem already might appear and in future this will get more relevant. Just until now it is not so likely that someone actually realises the existence of this problem. But there are hundred of tutorials teaching you, that it is a good idea to set the font-size of the html-element to 62.5% or to 10px for easier calculation of rem-values. Using media-queries then will make it necessary to use font-sizes of html-element smaller then 10px. 
The intention of a user to set the minimum font-size to 10px is - not having to deal with rendered fonts smaller then 10px. But it is not the intention to destroy the layout of a "modern" responsive webpage. The more developer do font-sizing with rem-units (and forget about this problem) the more this problem will appear. Minimum font-size should be applied to rendered fonts but to nothing else.
(In reply to Sebastian Mathis from comment #6)
> There is a substantial amount of Web content where this problem already
> might appear and in future this will get more relevant. Just until now it is
> not so likely that someone actually realises the existence of this problem.
> But there are hundred of tutorials teaching you, that it is a good idea to
> set the font-size of the html-element to 62.5% or to 10px for easier
> calculation of rem-values.

That's an poor technique that's abusing a feature for something it wasn't meant for, and (with 10px, anyway) is just as bad for the user as using absolute font size units.

Are there major sites that are actually affected by this?
Resolution: INVALID → DUPLICATE
You need to log in before you can comment on or make changes to this bug.