这是我正在使用的 fiddle :
html代码是:
<div class="body">
<div class="variation1 font700 green1">
<h2>
sample <span class="divider"> arrowshape </span>
</h2>
</div>
<div class="clear"></div>
<div class="variation2 font700 green2">
<h2>
as the text increases the font size must decrease but the block height must remain same <span class="divider"> as the text increases the font size must decrease but the block height must remain same </span>
</h2>
</div>
<div class="clear"></div>
<!-- OTHER HTML -->
</div>
我想调整文本使其适合 div,而不更改显示的箭头 block 的尺寸(大小)(文本大小可以更改,但 block 大小不能更改)。箭头 block 必须看起来像样本箭头,我面临的问题如变体 2 所示。有人可以帮我解决这个问题吗??
最佳答案
试试 jquery 插件 FITTEXT这对你有帮助
关于javascript - 自动调整字体大小以适应固定形状的 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18384470/