字体大小根据固定大小的div的宽度和高度而减小

时间:2019-05-09 16:16:27

标签: jquery html css font-size

我有一个固定尺寸的div。 div包含一些动态文本,其文本大小根据我的设置而增加。现在我想动态减小字体大小,因为有时文本尺寸很大,因此文本位于该div的外侧。

所以我进行了大量搜索,还使用fitText插件,但没有给出我想要的结果。

.fix {
  width: 500px;
  height: 500px;
  border: 2px solid black;
}
<div class=fix>

  <p>
  
  <h2>
  Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
  
  </h2>
  
  </p>
  
</div>

0 个答案:

没有答案