You are here : : Home > Free Resources > CSS Tutorials > Cool CSS Text Effects |
Free Web Design Resources
In this tutorial we will learn how to use CSS Styles to give stylish effects to text. Learn how to create shadow effects, inset effects, neon style effects, glossy styles, grunge style effects and more!
Please Note : some of the effects can be seen only in Fireworks and Google Chrome.
First we'll create text effects using the CSS Shadow Property and then we'll create text effects using the CSS Background Image Property.
The HTML code will be same for all the examples below. Only the CSS code will change.
Just put your text inside any div
or span
and give it an id=style
. For the example below, we are working with the text "CSS Text Effects".
1 2 3 4 5
<div id=style> CSS Text Effects </div>
Apply shadow to the text inside the <div> with the id style
.
text-shadow:(x-offset) (y-offset) (blur-radius) (color)
Three colored shadows are used here. So we'll have to define three shadow values, each separated by a comma.
1 2 3 4 5
#style{
text-shadow: 0 6px 4px #85c226,
-3px -5px 4px #fe2192,
3px -5px 4px #f7c200;
}
A single shadow is used here. The Pink(#fe2192) colored shadow has a y-offset value set at -15 pixel.
1 2 3 4 5
#style{
text-shadow:0px -15px 0 #fe2192;
}
A single Blue(#1E90FF) colored shadow is used here with a Blur Radius of 7 pixel.
The text color is also the same Blue(#1E90FF) color.
1 2 3 4 5
#style{
text-shadow: 0 0 7px #1E90FF;
background:#000000;
color: #1E90FF;
}
Two shadows are used here, each of them moved 1 pixel along the x-y axis in opposite directions.
The Background and the Text have the same Grey(#CCCCCC) Color.
1 2 3 4 5 6 7
#style{
background: #CCCCCC;
color: #CCCCCC;
text-shadow: -1px -1px 3px #666666,
1px 1px 3px #FFFFFF;
}
We'll do the exact opposite of what we did for the Inset Effect.
1 2 3 4 5
#style{
background: #CCCCCC;
color: #CCCCCC;
text-shadow: 1px 1px 3px #666666,
-1px -1px 3px #FFFFFF;
}
Here we'll use transparent images to create the Text Effects.
We just need to insert an empty <span></span> tag inside the <div> with id style
.
The transparent images will be used as the background for these span tags.
Then we'll position the <span> element over the text using z-index property to give it a different look.
Lets have look at the HTML code.
The text and the empty <span> is inside the <div> with id style
.
1 2 3 4 5
<div id=style> CSS Text Effects<span></span> </div>
We will have to define two separate styles for the style
div element and for the span element inside the div element.
The style
div element has a css position property set to relative so that the span element can be positioned related to the style
div element.
This is the image used for the grunge effect.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#style{
position:relative;
font-weight: bold;
color:red;
background: #000;
}
#style span{
position:absolute;
display:block;
top:0;
left:0;
height:100%;
width:100%;
z-index: 21;
background:url('images/grunge.png');
}
The code is the same as above, only the image is different.
This is the image used for the gloss effect.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#style{
position: relative;
font-weight: bold;
color:orange;
}
#style span{
position:absolute;
display:block;
top:0;
left:0;
height:100%;
width:100%;
z-index: 21;
background:url('images/glossy.png');
}
No portion of these materials may be reproduced in any manner whatsoever, without the express written consent of Entheos. Any unauthorized use, sharing, reproduction or distribution of these materials by any means, electronic, mechanical, or otherwise is strictly prohibited.