有没有办法将文本大小设置为浏览器窗口的百分比?例如:
h1
{
height: 15%;
/* in my ideal world this would be 15% of the window
(or parent) size rather than inherited font-size */
}
Run Code Online (Sandbox Code Playgroud)
在CSS3中:
h1{
font-size: 15vw; // relative to the viewport's width
font-size: 15vh; // relative to the viewport's height
font-size: 15vm; // relative to the ratio width/height of the viewport
}
Run Code Online (Sandbox Code Playgroud)
但是,这当然不适用于所有浏览器.
请看这里:http://www.w3.org/TR/css3-values/#viewport-relative-lengths
| 归档时间: |
|
| 查看次数: |
2358 次 |
| 最近记录: |