Tell me, is it possible to make the font on the site rubber - the size of which will vary depending on the resizing of the browser?
- oneCan. Most, as I understand it, it will be difficult for you. Therefore, you can use ready-made plugins, for example, this [FlowType] [1]. [1]: simplefocus.com/flowtype - Deonis
- Yes, that is what I meant. And to do yourself where you can see? I would like to understand. In our country, as far as I know, the font size as a percentage is not tied to the size of the browser or container. - ahel73
- @ ahel73, this is done through js, the last time I looked in this direction, it was just the selection of the width by dividing / multiplying by two (flowtype judging by the source code does not do this, which means it can be quite wrong on exotic fonts). - zb '
- Thank. @eicto, you said "it was just a fit of dividing / multiplying by two," if you can use a formula, otherwise I don't catch up ( - ahel73
- @ ahel73, well, there was the question of placing the string in a block of a certain width. They did it like this: they searched for the optimal font size (so that it did not climb over the width of the block and was at the same time the maximum size), this is done approximately as in the algorithm of guessing a number - we take a lot of things, - if it does, we divide half of it from the difference that climbs, to the fact that not climbs, as soon as the result becomes less than the minimum step, we consider the latter "climbs" for the answer. - zb '
|
1 answer
Yes you can. Even without the intervention of javascript. Here it is :
.demo { font-size: 3vw; /* 3% of viewport width */ }
Be sure to read this article here:
Browser Support
IE 9+, Firefox 19+, Chrome 20+, Safari 6+, Opera 23+
- Thanks, be sure to learn) - ahel73
|