textarea
{text-shadow:white 0px 1px 0px, white 0px -1px 0px, white -1px 0px 0px, white 1px 0px 0px, white -1px 1px 0px, white 1px 1px 0px, white -1px -1px 0px, white 1px -1px 0px, white 0px 1.5px 0px, white 0px -1.5px 0px, white -1.5px 0px 0px, white 1.5px 0px 0px, white -1.5px 1.5px 0px, white 1.5px 1.5px 0px, white -1.5px -1.5px 0px, white 1.5px -1.5px 0px, rgb(133, 133, 133) 0px -1px 4px, rgb(133, 133, 133) 0px 3px 4px, rgb(133, 133, 133) 3px 0px 4px, rgb(133, 133, 133) -3px 0px 4px;
color:red;
}
<textarea >default text in the textarea
</textarea>
如何在画布文本中应用此文本阴影。我搜索了各种方法,如(http://jsfiddle.net/DirkWeber/nnqc8/1/light/),我无法在画布文本中复制这种类型的文本阴影。请告诉我如何实现这一目标。
答案 0 :(得分:3)
<强> Canvas example 强>
var canvas = document.getElementsByTagName("canvas")[0],
ctx = canvas.getContext('2d');
ctx.font="75px verdana";
ctx.shadowColor="black";
ctx.shadowBlur=10;
ctx.lineWidth=10;
ctx.strokeStyle = "white";
ctx.strokeText("HELLO",25,100);
ctx.shadowBlur=0;
ctx.fillStyle="red";
ctx.fillText("HELLO",25,100);
<canvas id="c" width="300" height="130"></canvas>
CSS示例
.text {font-size: 3em;
-webkit-text-stroke: 2px white;
-webkit-text-fill-color: black;
-webkit-animation: fill 1s infinite alternate;
text-shadow:2px 2px 10px #000;
}
<div class="text">default text in the textarea
</div>