HTML / CSS - 调整font-size以填充父高度和宽度 [英] HTML / CSS - adjust font-size to fill parent height and width

查看:612
本文介绍了HTML / CSS - 调整font-size以填充父高度和宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个< div> 元素,当浏览器窗口调整大小时调整大小。

I have a <div> element that resizes as the browser window resizes.

< div> 里面有一段文字:

<div style="width:80%; height:80%; margin:10%;">
    <p>Paragraph of text. Paragraph of text. Paragraph of text.</p>
</div>

我想让文字更改 font-size ,因为我调整了< div> 的大小,以便文本将出现100%的可用空间。

I want the text to change font-size as I resize the <div>, so that the text will occuypy 100% of the available space.

如何实现这种效果?

是否使用百分比font-size?

我必须使用Javascript吗? />

How can I achieve this effect?
Would it be with a percentage font-size?
Would I have to use Javascript?

提前感谢!

推荐答案

为此: http://fittextjs.com/

这篇关于HTML / CSS - 调整font-size以填充父高度和宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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