Dynamic/flexible font sizing: is it possible to make the font size relative to the zoom setting of chrome? how to make the font size relative to the zoom?

font-size: 20pt;

this seems to be something that changes the size of the font

say the zoom for chrome is 100%

say the font size is 20

say the zoom is 80%

then the font size would be 80% of 20

and so on

the font size is relative to the zoom

the font size is proportional to the zoom

zoom-based fonts

font size dependent on zoom

zoom-dependent font sizing

dynamic fonts

flexible fonts

That’s literally what zoom does, you’re describing zoom.

Edit: however you’re specifying font size in print units (1pt == 1/72 of an inch), so although modern browsers should zoom regardless, they might not in that case. The solution in that case is don’t use units designed for printed documents.

1 Like

oh yea that is what zoom does

i gave the wrong example, what i mean is:

the font size is based on the zoom

…do what did i mean actually

so what i want is the font being a percentage size, not a ‘fixed number’

so the font size is a % of the zoom size

so if zoom is 100%

and font % is 10%

then it’s 10% o f the zoom % always

1 Like

You can use this or this:

`
#test{

zoom: 20%;
font-size: 20vw;
}
`

also want

relative fonts

that means the text is 60% of the title size

the text size is relative to something else

relative fonts

zoom is a non standard CSS property that…zooms, it just applies zoom. It was for old Internet Explorer, is non-standard, and shouldn’t be used (and doesn’t really make any sense here)

vw is a percentage of the viewport width, so 1vw is 1% of the width of the viewport. Not sure how it interacts with zoom: as it’s based on the size of the viewport, I don’t see how zoom will affect it at all.

1rem would be the base text size (by default, 16px). So

h1 {
  font-size: 1.6rem;
}

Go up from the base size, not down from the largest size, it’s much easier.

CSS is fine, they’re just different ways of measuring size. There have to be multiple ways because there are different ways of sizing things.

rem is specific to CSS, as are the viewport units mentioned above (vw, and vh which is the height of the viewport). All the rest are just standard units

em is the width of the “m” character. In CSS it is simplified to the font size of the current element.

Because that changes depending on how different parts of the text are sized, rem was introduced which is the base size, and is generally simpler to use. Rather than being the font size of the current element, it is the font size of the root element. So if you don’t set any size, 1rem will be 16px. If you set a font-size of 100px on the html element, then 1rem will be 100px.

% is percent and doesn’t work well for fonts.

px is the size in pixels, but that can change depending on device resolution.

cm, mm, in are self-explanatory.

pt is a point,1/72 of an inch, pc is a pics, 12 points, they are standard typographic units for print media. Not used in CSS very much at all.

And it supports ch (width of a “0” character) and ex (height of an “x” character) but they are not really used. Again, these are typographic units.

Title is 100.
Other text is 60.
60 is the base size.
100 ÷ 60 = 1.66666…
60 × (100 ÷ 60) = 100
1 × (100 ÷ 60) = 1.666666…

Well it’s just easier, it’s nothing to do with code. Start from a common size, then size relative to that, rather than starting with an uncommon size and trying to figure out the maths from there.

so this thing is doing what is asked? ‘1.666666…’ ?

h1 {
font-size: 1.6rem;
}

what’s this ‘rem’ thing doing exactly?


that’s the lsit, that’s not very long at all

and most of them arent used

i guess it didnt matter


nothing to do with code. Start from a common size, then size relative to that, rather than starting with an uncommon size and trying to figure out the maths from there.

its everything to do with code, or laugnage or w/e is talked about, cos its the tool being used

if someone that it’s ‘math’ then its still the same its stil the code, the code is restricted by math

so maht is part of the code

so we get to the point that’s its still about the code the tool used

its always like that for eveyr single thing in this universe

until i see an exception


but we still end on the only point that matters:

but none of this has anything to do with zoom and that was the main question

some questions ending with ? are still unanswered & unsolved

This is three months later, and I’m sorry I didn’t immediately reply, but what have you looked at in these three months? There are vast resources on CSS typography a simple Google away, thousands and thousands and thousands of pages of explanation, from beginner resources to advanced typographic guides. If you’re coming back 3 months after your original post and posting this, I’m assuming you’ve made absolutely zero effort trying to find out anything by yourself: I’m sorry I missed your post and didn’t reply, but come on. I get English is not your first language, but there is no way, given how big a subject this is, that there are not resources on this subject easily available to you.

So

The root of an HTML page is the <html> element (the top-level element).

The default size of this is 16px (although you can make it any size you want).

1rem means 100% of the root font size, ie the font size on the root element, ie by default 16px.

If you want something 60% larger than that — ie 160% — you get 1.6. 160% of 1 is 1.6.

1 Like

there’s 100% absolutely no good content on this entire web, especially not anything that is ‘easily available’

1. if that was accurate, then you’d be able to link to each of the answers of the questions asked

2. and exactly how the entire process of how anyone that knows none of these terms are able to locate them, then there’s actual evidence

https://www.w3schools.com/cssref/css_units.asp

This is total rubbish. You either haven’t looked or you’re asking completely the wrong questions

Well there are a load of links to things on rem units just there.

I answered you questions one by one:

  • you asked how to get zoom-dependent font sizing. That’s what zoom does, it zooms the size, so that’s not really a question that makes sense.
  • you asked how to get the text size 60% of the title, how to get relative font sizong. I told you to use relative units.

So you don’t know how to look for terms you’re unfamiliar with after you were told what they were? I can literally scroll up several posts and there we go, there are the terms that you don’t know written down. So that means you’ve completely ignored anything I’ve written; you could have Googled anything in my post, rem being an obvious example, but you have not done that: instead you’ve said there are no resources anywhere on the internet. I can find thousands of web pages with useful info by just typing “css rem” into Google or “what are rems CSS” or whatever