How can I scale font size of text to fit inside a div that also scales when the browser window is resized?

这一生的挚爱 提交于 2019-12-12 04:47:19

问题


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);


来源:https://stackoverflow.com/questions/10670088/how-can-i-scale-font-size-of-text-to-fit-inside-a-div-that-also-scales-when-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!