如何缩放文本的字体大小适合在一个div,也调整浏览器窗口调整大小时? [英] How can I scale font size of text to fit inside a div that also scales when the browser window is resized?

查看:481
本文介绍了如何缩放文本的字体大小适合在一个div,也调整浏览器窗口调整大小时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我对这一切都很新。我已经构建了我的布局使用div,它们的维度设置为百分比,以便它们缩放到正确的大小,当浏览器窗口调整大小。一些div在导航栏中形成按钮(每个都有文本)。但是当我调整浏览器窗口的大小时,文本保持较大。是否有任何解决方法?

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?

推荐答案

使用:

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

这篇关于如何缩放文本的字体大小适合在一个div,也调整浏览器窗口调整大小时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆