If we turn off top
and transform
, this is how it looks:
Then, the block is moved to the center (using those top
and transform
), but its width is determined by the "squeeze" caused by left
(remember that it's a div, so by default it wants to be 100% of the parent's width).
It means that the amount of "squeezing" is dependent on the screen width.
The thing is font-size
is also dependent on the screen width: 3vw
.
Since both the box's width and the font size is calculated by the width of the container (which is in this case, the same size as the viewport itself), you get that constant size.
If you had a constant font size, let's say of 2rem
, this is how it will look:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…