Wednesday, 26 October 2011

All CSS Text Properties

This property is used to set the text property by giving effects to text like color, alignment, word spacing, letter spacing.

Property
Description
Values
CSS
Color
Sets the color of a text
color
1
Direction
Sets the text direction
ltr
rtl
2
Line-height
Sets the distance between lines
normal
number
length
%
1
letter-spacing
Increase or decrease the space between characters
normal
length
1
text-align
Aligns the text in an element
left
right
center
justify
1
text-decoration
Adds decoration to text
none
underline
overline
line-through
blink
1
text-indent
Indents the first line of text in an element
length
%
1
text-shadow

none
color
length

text-transform
Controls the letters in an element
none
capitalize
uppercase
lowercase
1
unicode-bidi

normal
embed
bidi-override
2
vertical-align
Sets the vertical alignment of an element
baseline
sub
super
top
text-top
middle
bottom
text-bottom
length
%
1
White-space
Sets how white space inside an element is handled
normal
pre
nowrap
1
Word-spacing
Increase or decrease the space between words
normal
length
1

Example-1

<html>
<head>
          <style type=”text/css”>
                   body
                   {
                             color:blue;
                             direction:rtl;
                             letter-spacing:20px;
                             white-space:normal;
                             text-transform:uppercase;
                   }
          </style>
</head>
<body>
Hello World
</body>
</html>


Example-2

<html>
<head>
          <style type=”text/css”>
                   body
                   {
                             line-height:20px;
                             text-aling:center;
                             word-spacing:10px;
                   }
                   .test
                   {
                             text-decoration:none;
                   }
          </style>
</head>
<body>
Hello World<br/>
<a href="test.html" class="test">Click Here</a>
</body>
</html>

No comments:

Post a Comment