嗯,可以的。但是其实讲真这个效果不太常用呢,因为只支持Webkit
/* 宽度和颜色 */-webkit-text-stroke: 4px navy
/* 默认 */
-webkit-text-stroke: inherit
-webkit-text-stroke: initial
-webkit-text-stroke: unset
即-webkit-text-stroke: <length><color>
<length>
文本描边宽.
<color>
文本颜色.
原理:利用两个层分别定义不同的边框颜色,一个在内,一个在外即可,在内的自适应。代码如下,已经测试通过:
<div style="width:300pxheight:30pxline-height:30pxborder:1px solid red"><div style="width:100%height:30pxline-height:30pxborder:1px solid green">文本内容
</div>
</div>