text-stroke属性用于向文本添加描边。此属性可用于更改文字的描边宽度和颜色。使用-webkit-前缀支持此属性。
text-stroke是text-stroke-width和text-stroke-color(给文本填充颜色)两个属性的简写。
语法:
text-stroke: <width> <color>;
参数:
width:设置文字的描边厚度
color:设置文字的描边颜色
示例:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style type="text/css"> @import url(https://fonts.googleapis.com/css?family=Bangers); body { font-size: 50%; line-height: 1; } h1 { font: 8em/1 Bangers, sans-serif; -webkit-text-stroke: 1px black; color: #fff; } </style> </head> <body> <h1>Hello World</h1> </body> </html>
效果图:
有了text-stroke属性,咱们可以非常轻易的实现文本描边效果,也告别了使用text-shadow属性来模拟文本描边效果。
更多web前端相关知识,请查阅 HTML中文网 !!
以上就是css描边属性是什么?的详细内容,更多请关注0133技术站其它相关文章!