I
I
Ingerniated2018-03-16 12:26:25
css
Ingerniated, 2018-03-16 12:26:25

Is it possible to set the font size in %?

Good afternoon.
Is it possible to set the font size other than in px?
So that it itself changes depending on the height of the block.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Ivan Bogatov, 2018-03-16
@Malekith

https://www.w3schools.com/cssref/pr_font_font-size.asp
You can. But it will change from "basic".

S
Socrates, 2018-03-16
@Karmov69

em

M
Maxim Timofeev, 2018-03-16
@webinar

Is it possible to set the font size other than in px?

It is possible and not only in%, there are a bunch of other units: pt, vh, vw, vmin, vmax, em, rem, etc.
only through js. The calculation is based on the base font size. There is an option with vh and sometimes it helps if the height of the block depends on the height of the window or vice versa, then sometimes you can calculate the font size in this way and specify it in vh. But that's the way it is.

B
Bulat Kutliev, 2018-03-16
@SlowRider

Developing the idea Maxim Timofeev
Set a block of fixed proportions and set the font size to vh.
https://codepen.io/kutliev/pen/mxEYPQ
But it really works so-so.
When you change the height is normal, when you change the width everything floats.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question