关于canvas和css中对文字的外描边和内描边

html-css011

关于canvas和css中对文字的外描边和内描边,第1张

可以看出fillText实心文字先绘制,strokeText空心文字后绘制,他们坐标一致,所以直接覆盖可实心文字,形成了像文字内部描边

通过text-shadow添加文字阴影可以形成对文字的外描边

注释:Internet Explorer 9 以及更早版本的浏览器不支持 text-shadow 属性。

可以看下这个文章,关于text-shadow

https://www.cnblogs.com/wuchuanlong/p/5985350.html

<body>

<div id="nav">

布局

</div>

</body>

CSS代码: #nav{border: solid #000000 3px} 黑色外边框,宽度为3px;

楼上说法不大对啊。

我觉得他的意思应该是文字的滤镜属性。

一般情况下的浏览器都没有问题,IE6之前的版本可能不支持。

代码实现如下:

<style type=”text/css”>

body {

font:12px “Verdana”

filter:alpha(style=1,startY=0,finishY=100,startX=100,finishX=100)

background-color:#3366cc

}

.sizscolor {

font-size:14pxfont-weight:bold

position:absolute

padding:4px

filter:

Dropshadow(offx=1,offy=0,color=white)

Dropshadow(offx=0,offy=1,color=white)

Dropshadow(offx=0,offy=-1,color=white)

Dropshadow(offx=-1,offy=0,color=white)

}

#english {

font-size:9px

}

</style>

<span id=”english”>This is the prospect of filter - dropshadow.</span>

<br><br>

<div class=”sizscolor “>中文描边效果</div>