How can I scale font size of text to fit inside a

2019-09-05 17:27发布

问题:

Hello I am fairly new to all of this. I have built my layout using divs that have their dimensions set as percentages so that they scale to the correct size when the browser window is resized. Some of the divs form buttons in a navigation bar (with text on each). But when I resize the browser window the text stays large. Is there any way to solve this?

回答1:

Use this:

iStandardWidth = 960;
topofthetopdiv.style.zoom = parseInt(window.innerWidth/iStandardWidth, 10);