Beruflich Dokumente
Kultur Dokumente
CSS Text
Search w3schools.com: Select Language
HOME
HTML
C SS
JAVASC RIPT
JQUERY
XML
ASP.NET
PHP
SQL
MORE...
R EFER ENC ES
EXAMPLES
FO R UM
ABO UT
Get Certified
Study Web Technologies and get a diploma at w3schools.com
Like
76k
CSS Basic
CSS HOME CSS Introduction CSS Syntax CSS Id & Class CSS How To
CSS Text
Previous Next Chapter
WEB HOSTING
Best Web Hosting eUK Web Hosting UK Reseller Hosting Domain, Hosting & Email
TEXT FORMATTING
Th is t e xt is s t yle d w it h s o me o f t h e t e xt fo rma t t in g p ro p e rt ie s . Th e h e a d in g u s e s t h e t e xt -a lig n , t e xt -t ra n s fo rm, a n d co lo r p ro p e rt ie s . Th e p a ra g ra p h is ind e nte d , a lig ne d , a nd the s p a ce b e tw e e n cha ra cte rs is s p e cifie d . Th e u n d e rlin e is re mo ve d fro m t h e " Try it yo u rs e lf" lin k.
CSS Styling
Styling Backgrounds Styling Text Styling Fonts Styling Links Styling Lists Styling Tables
WEB BUILDING
Download XML Editor FREE Website BUILDER
Text Color
The color property is used to set the color of the text. With CSS, a color is most often specified by: a HEX value - like "#ff0000" an RGB value - like "rgb(255,0,0)" a color name - like "red" Look at CSS Color Values for a complete list of possible color values. The default color for a page is defined in the body selector.
STATISTICS
Browser Statistics OS Statistics Display Statistics
CSS Advanced
CSS Grouping/Nesting CSS Dimension CSS Display CSS Positioning CSS Floating CSS Align CSS Pseudo-class CSS Pseudo-element CSS Navigation Bar CSS Image Gallery CSS Image Opacity CSS Image Sprites CSS Media Types CSS Attribute Selectors CSS Summary
Example
b o d y{ c o l o r : b l u e ; } h 1{ c o l o r : # 0 0 f f 0 0 ; } h 2{ c o l o r : r g b ( 2 5 5 , 0 , 0 ) ; }
Try it yourself
For W3C compliant CSS: If you define the color property, you must also define the background-color property.
Text Alignment
The text-align property is used to set the horizontal alignment of a text. Text can be centered, or aligned to the left or right, or justified. When text-align is set to "justify", each line is stretched so that every line has equal width, and the left and right margins are straight (like in magazines and newspapers).
CSS Examples
CSS Examples CSS Quiz CSS Certificate
Example
h 1{ t e x t a l i g n : c e n t e r ; } p . d a t e{ t e x t a l i g n : r i g h t ; } p . m a i n{ t e x t a l i g n : j u s t i f y ; }
Try it yourself
CSS References
CSS Reference CSS Selectors CSS Reference Aural CSS Web Safe Fonts CSS Units CSS Colors CSS Color Values CSS Color Names CSS Color HEX
Text Decoration
The text-decoration property is used to set or remove decorations from text. The text-decoration property is mostly used to remove underlines from links for design purposes:
Example
a{ t e x t d e c o r a t i o n : n o n e ; }
Try it yourself It can also be used to decorate text:
Example
h 1{ t e x t d e c o r a t i o n : o v e r l i n e ; } h 2{ t e x t d e c o r a t i o n : l i n e t h r o u g h ; } h 3{ t e x t d e c o r a t i o n : u n d e r l i n e ; }
Try it yourself
w3schools.com/css/css_text.asp
1/3
8/4/13
CSS Text
It is not recommended to underline text that is not a link, as this often confuses users.
Text Transformation
The text-transform property is used to specify uppercase and lowercase letters in a text. It can be used to turn everything into uppercase or lowercase letters, or capitalize the first letter of each word.
Example
p . u p p e r c a s e{ t e x t t r a n s f o r m : u p p e r c a s e ; } p . l o w e r c a s e{ t e x t t r a n s f o r m : l o w e r c a s e ; } p . c a p i t a l i z e{ t e x t t r a n s f o r m : c a p i t a l i z e ; }
Try it yourself
Text Indentation
The text-indent property is used to specify the indentation of the first line of a text.
Example
p{ t e x t i n d e n t : 5 0 p x ; }
Try it yourself
More Examples
Specify the space between characters This example demonstrates how to increase or decrease the space between characters. Specify the space between lines This example demonstrates how to specify the space between the lines in a paragraph. Set the text direction of an element This example demonstrates how to change the text direction of an element. Increase the white space between words This example demonstrates how to increase the white space between words in a paragraph. Disable text wrapping inside an element This example demonstrates how to disable text wrapping inside an element. Vertical alignment of an image This example demonstrates how to set the vertical align of an image in a text.
Previous
Next Chapter
w3schools.com/css/css_text.asp
2/3
8/4/13
CSS Text
Top 10 Tutorials
HTML Tutorial HTML5 Tutorial C SS Tutorial C SS3 Tutorial JavaScript Tutorial jQuery Tutorial SQL Tutorial PHP Tutorial ASP.NET Tutorial XML Tutorial
Top 10 References
HTML/HTML5 Reference C SS 1,2,3 Reference C SS 3 Browser Support JavaScript HTML DOM XML DOM PHP Reference jQuery Reference ASP.NET Reference HTML C olors
Examples
HTML Examples C SS Examples XML Examples JavaScript Examples HTML DOM Examples XML DOM Examples AJAX Examples ASP.NET Examples Razor Examples ASP Examples SVG Examples
Quizzes
HTML Quiz HTML5 Quiz XHTML Quiz C SS Quiz JavaScript Quiz jQuery Quiz XML Quiz ASP Quiz PHP Quiz SQL Quiz
Color Picker
Statistics
Browser Statistics Browser OS Browser Display
RE P O RT E RRO R
HO ME
TO P
P RI N T
FO RU M
A BO U T
A D V E RT I SE WI T H U S
W3Schools is optimized for learning, testing, and training. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use and privacy policy. C opyright 1999-2013 by Refsnes Data. All Rights Reserved.
w3schools.com/css/css_text.asp
3/3