HomeBlog
Frequently Used Commands of CSS - 羡辙杂俎
2015.04.15 10:42:34

Frequently Used Commands of

CSS

Selector

:not()

Select But …

:not(.some-class) {
}

:nth-child()

Select Even Elements

:nth-child(even) {
}

E.g., set the background of even lines in tables to be different than that of odd ones.

tr {
    background-color: red;
}

tr:nth-child(even) {
    background-color: green;
}

Others

Leading zero

To save the CSS file size, 0.5 should be written without a leading zero as .5.

博文对你有帮助吗?如果有的话,要不要送我一本书呢?:heart_eyes:

微信公众号“羡辙部落格”(xianzheblog)提供本站优质非技术类博文推送。

Creative Commons License
Every blog post in this site by Wenli Zhang is licensed under a CC 3.0 License, based on a work at Github. You can see the source code of this blog site at github.com/Ovilia/blog.

Comments

comments powered by Disqus