css中calc()的使用 - 天上云好白

WBOY
Release: 2016-05-20 13:48:52
Original
1384 people have browsed it

calc()是css3中新出现的特性,可以用于动态计算,非常方便。

首先是兼容性

再来看看怎么使用

<span style="color: #800000;">html</span>{<span style="color: #ff0000;">
    font-size</span>:<span style="color: #0000ff;"> 20px</span>;
}<span style="color: #800000;">
div</span>{<span style="color: #ff0000;">
    width</span>:<span style="color: #0000ff;"> calc(50% - 1px)</span>;<span style="color: #ff0000;">
    height</span>:<span style="color: #0000ff;"> calc(100px + 1rem)</span>;
}
Copy after login

要注意的是,计算符号两边需要留空格。

非常的简单易用。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template