CSS Text Effects are a set of techniques used to enhance the appearance of text on a web page. These effects can be used to make text more visually appealing, easier to read, and more engaging for users. CSS Text Effects can be applied to any text element on a web page, including headings, paragraphs, and links.
CSS Text Effects can be achieved using a variety of CSS properties and values. Some of the most commonly used CSS Text Effects include:
Here are some examples of how to apply CSS Text Effects to your web page:
To add a text shadow to your text, use the text-shadow
property:
<p style="text-shadow: 2px 2px 5px #000000;">This text has a shadow.</p>
This will add a shadow to the text, with a horizontal offset of 2 pixels, a vertical offset of 2 pixels, a blur radius of 5 pixels, and a color of black.
To add a text stroke to your text, use the -webkit-text-stroke
property:
<p style="-webkit-text-stroke: 1px black;">This text has a stroke.</p>
This will add a stroke to the text, with a width of 1 pixel and a color of black.
To add a text gradient to your text, use the background-clip
and text-fill-color
properties:
<p style="background: linear-gradient(to right, #ff0000, #0000ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">This text has a gradient.</p>
This will add a gradient to the text, with a start color of red and an end color of blue, fading from left to right.
To add a text glow to your text, use the text-shadow
property with a larger blur radius:
<p style="text-shadow: 0 0 10px #ffffff, 0 0 20px #ffffff, 0 0 30px #ffffff;">This text has a glow.</p>
This will add a glow to the text, with three shadows of increasing blur radius and a color of white.
To add a text animation to your text, use the @keyframes
rule and the animation
property:
@keyframes example {
0% { color: red; }
50% { color: blue; }
100% { color: green; }
}
<p style="animation: example 5s infinite;">This text is animated.</p>
This will add an animation to the text, with a color change from red to blue to green over a 5 second period, repeating indefinitely.