2017-04-07 93 views
0

I'm usign font-size:vw;制作字体大小与父div宽度和高度响应css

#foti_module_wrapper .tools-nav-option i { 
    color: #666666; 
    font-size: 6.2vw; 
} 
#foti_module_wrapper .tool-nav-label { 
    font-size: 3.2vw; 
    line-height: 4px; 
} 
#foti_module_wrapper .tool-item { 
    -webkit-box-flex: 1; 
    -webkit-flex: 1 0 auto; 
    -ms-flex: 1 0 auto; 
    flex: 1 0 auto; 
    display: flex; 
    text-align: center; 
} 
#foti_module_wrapper .tools-nav-option { 
    -webkit-box-flex: 1; 
    -webkit-flex: 1 0 auto; 
    -ms-flex: 1 0 auto; 
    flex: 1 0 auto; 
    padding: 10px; 
    color: #292929; 
    font-size: 20px; 
    text-align: center; 
    line-height: inherit; 
    cursor: pointer; 
    border: 0; 
    -webkit-appearance: none; 
    -moz-appearance: none; 
    appearance: none; 
    z-index: 2; 
    background: white; 
} 

在晴朗的手机作品,但在平板电脑上的字体图标和文本溢出我的工具项填充...

我想避免这种

enter image description here enter image description here

我想要这个结果: enter image description here

+1

以及你可以很容易地使用媒体查询来为平板电脑编写代码 –

+0

我不想使用媒体查询 –

+1

没有媒体查询的唯一方法是js!是否有一个不使用媒体查询的原因 - 导致它正是它所做的... – MarcelD

回答

0
#foti_module_wrapper .tool-nav-label { 
    font-size: 3.2vw; 
    line-height: 4px; 
} 

您可以使用字体大小:3.0vh,如果你希望它是响应与高度也。 Vw和Vh分别代表宽度和高度。

相关问题