2016-09-14 53 views
0

由于我有谷歌这个并获得很多答案,但只为调整字号调整大小,我需要调整大小/增加 - 减少字符串的长度为每屏幕大小。根据屏幕尺寸调整字符串长度

我使用动态文本创建多页混合应用程序,并希望该文本将设置为DIV设备的固定长度,如果文本长度大于装置的高度,创造新的div作为新页面也更大。

<!-- for eg. Device Height 480px --> 
<div class="page"> 
    test text and the 
    text that is store 
    here with full length 
    of the div and device 
    is no longer to adjust 
</div> 
<div class="page"> <!-- This become another page of application --> 
    all this string. 
</div> 

<!-- Device Height 640px --> 
<div class="page"> 
    test text and the 
    text that is store 
    here with full length 
    of the div and device 
    is no longer to adjust 
    all this string. 
</div> 

目前,我正在处理图像的页面转换成格,并与全宽和经销商的高度为屏幕的中心设置。但实际上,我需要将动态文本设置为该div。所以我需要任何对我有帮助的建议。

<!-- Working - With an image --> 
<div class="page"> 
    <img src="images/page1"> 
</div> 
<div class="page"> 
    <img src="images/page2"> 
</div> 

回答

0

可以使用wiewport与排版或什么...

body { 
 
    font-size: 1vw; 
 
} 
 
img { 
 
    width:99vw; 
 
}

链接:https://css-tricks.com/viewport-sized-typography/

+0

正如我已经说过,我不想要的图像或字体大小的宽度,我想增加减少字符串的长度与最有可能的JavaScript –

+0

不要ü已经看到了吗? http://maloweb.com/snippets/responsivestuff.html –

+0

(增加/减少)字符串长度。对于例如“我的名字是基兰”。输出:

My name is
Kiran
- 但只有当,“我的名字是基兰”太大而不适合页面的高度宽度。考虑我的页面大小为风格= “宽度:200像素,高度:100像素; FONT-SIZE:26px;” –