Heim  >  Artikel  >  Web-Frontend  >  CSS黑科技补充篇_html/css_WEB-ITnose

CSS黑科技补充篇_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:40:051738Durchsuche

原文来自:https://jellybool.com/post/css-that-you-may-not-know-part-2

继上一次写的CSS黑科技之后,这次貌似还专门去找了一些CSS中可能还是比较不太会引起开发者注意的属性。

empty-cells

其实在table中,你可以使用empty-cells这个属性来指定相应的样式,比如:

table {  empty-cells: hide;}

上面这一行声明就可以将table元素中的空单元格隐藏起来。

border-image

其实这个在开发中可能会比较少见到,如果不是我特意去看文档,真心不会发现还有这个border-image,没错,就如名字的意思一样,你可以给border指定image:

.border-image-example {      -webkit-border-image: url(border-image.jpg) 45 20 45 30 repeat;      -moz-border-image: url(border-image.jpg) 45 20 45 30 repeat;      border-image: url(border-image.jpg) 45 20 45 30 repeat;}

text-decoration

在习惯了对text-decoration赋值为none之后,我们需要重新来认识一下这一位小伙伴了,它其实是可以接受三个变量声明:

a {  text-decoration: overline aqua wavy;}

这三个分别是代表:text-decoration-line, text-decoration-color 和 text-decoration-style

clip

可能很多人在刚开始使用clip的时候都是这样写的:

.example {    clip: rect(110px, 160px, 170px, 60px);}

然后很惊讶地发现竟然没有起作用,为什么呢?所以在这里需要注意的地方是clip是只在position为absolute或position为fixed时候起作用的。

::first-letter

这个感觉比较神奇,虽然对于我们常用CSS修饰中文文本可能没有很大的用处,不过我看到这个时候其实还是觉得比较意外的,竟然还有这个东西:

<br /><br /><div class='text'>    I am sample text</div>

然后CSS可以这样写:

.text::first-letter {  color: blue;  background: yellow;}

第一个字母I就会被修饰到,很神奇。暂时就补充这么多....

Happy Hacking

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn