顾名思义“text-fill-color”就是文字填充颜色而“text-stroke”就是文字描边。还别说,两个属性能够制做出各类炫酷的文字效果,不过IE系列都不支持,不过好在webkit都支持良好。web
<style> h1{ -webkit-text-fill-color:red; } </style> <h1>博客园</h1>
话说倒有点像color
了,这种状况下却是和color
真的是同样的。动画
得注意一下:若是同时设置了
text-fill-color
和color
那么color
不会起做用。url
h1{ -webkit-text-fill-color:red; color:green; }
<style> h1{ -webkit-text-stroke:1px red; } </style> <h1>博客园</h1>
好像这两个单独使用没有啥亮点,但若是结合起来使用那就不同了。spa
<style> body{ background-color:#000; } h1{ font-size:60px; -webkit-text-fill-color:transparent; -webkit-text-stroke:1px #fff; } </style> <h1>博客园</h1>
原来就是设置边框为白色而后然文字颜色透明,背景颜色黑色,也就是黑白对比,天然文字就只能看见边框了。code
background-clip:text
结合text-fill-color
制做文字渐变效果h1{ font-size:60px; background: linear-gradient(to bottom,#FCF,#000); -webkit-background-clip:text; -webkit-text-fill-color:transparent; }
注意:
background-clip
必须放在background
后面否则不起做用,之因此要用background
是由于text-fill-color
不能使用linear
因此只好借助background
了。blog
<style> h1{ font-size:60px; background: url(bg.jpg) repeat; -webkit-background-clip:text; -webkit-text-fill-color:transparent; } </style> <h1>博客园</h1>
<style> h1{ font-size:60px; background: url(bg.jpg) repeat; -webkit-background-clip:text; -webkit-text-fill-color:transparent; animation:fn 5s alternate infinite; } @keyframes fn{ 0%{ background-position:0px 0px; } 20%{ background-position:30% 0px; } 50%{ background-position:50% 0px; } 70%{ background-position:70% 0px; } 100%{ background-position:100% 0px; } } </style> <h1>博客园</h1>
待续...ip