Home >Web Front-end >CSS Tutorial >Can CSS3 Add a Border to Text?
In the realm of web design, CSS3 continues to revolutionize styling capabilities. Amidst the plethora of new border enhancements, one question arises: can we now adorn our fonts with a border? Particularly, the iconic solid white border surrounding the blue Twitter logo has sparked curiosity.
While not yet widely supported, there is indeed an experimental CSS property that holds the key: text-stroke. This property, accessible via the -webkit prefix, allows you to add a stroke to your text.
h1 { -webkit-text-stroke: 2px black; font-family: sans; color: yellow; }
The above CSS will render an
Currently, text-stroke is only supported in WebKit-based browsers such as Chrome and Safari. For cross-browser compatibility, you can explore alternative techniques, such as:
The above is the detailed content of Can CSS3 Add a Border to Text?. For more information, please follow other related articles on the PHP Chinese website!