[英]Using CSS3 font-stretch instead of wrapping
I have a div with a text that overflows when viewed from a phone. 我有一个div,其中的文字在通过电话查看时会溢出。 Is it possible to detect that the text is overflowing and change the font-stretch property automatically? 是否可以检测到文本溢出并自动更改font-stretch属性?
Do you have the below meta tag in your html page?. 您的html页面中是否包含以下meta标签?
<meta name="viewport" content="width=device-width, initial-scale=1.0">
If not please add it to your code, this will ensure that the page is rendering fine irrespective of from what device it is being viewed. 如果不是,请将其添加到您的代码中,这将确保无论使用哪种设备查看页面,页面都能正常显示。
HTH 高温超导
I could not detect wrapping, and ended up using a @media rule to condense the text: 我无法检测到换行,最终使用了@media规则来压缩文本:
@media screen and (max-width: 800px) {
body {
font-stretch: condensed;
} }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.