问题
Below is the code I was using to do a Text Stroke outline of 1px. But how do I get the outline thicker? If I just replace all "1px" with "5px", the result looks crazy.
HTML
<div class="element">
Hello!
</div>
CSS
.element {
color:white;
text-shadow:
-1px -1px 0 #000,
1px -1px 0 #000,
-1px 1px 0 #000,
1px 1px 0 #000;
}
回答1:
You might use SVG
as well, though it requires more code:
.element {
font-size: 50px;
}
svg {
width: 100%;
height: 1.3em;
}
svg text {
fill: pink;
stroke-width: 8px;
paint-order: stroke;
stroke: violet;
}
<div class="element">
<svg><text x="8px" y="75%">Hello kitty!</text></svg>
</div>
回答2:
You can consider text-stroke
but you need to pay attention to browser support
.element {
color: white;
font-size:50px;
-webkit-text-stroke: 5px #000;
}
<div class="element">
Hello!
</div>
来源:https://stackoverflow.com/questions/51459653/using-css-how-do-you-create-a-text-stroke-outline-that-is-thicker-than-1px