CSS Text Properties

2
 1/10/14 CSS Tex t fi le:///E:/Document/W3School /W3school s Offli ne Versi on/w w w.w 3school s.com/css/css_tex t.asp 2/3 Example h1 {text-decoration:overline;} h2 {text-decoration:line-through;} h3 {text-decoration:underline;} h4 {text-decoration:blink;} Try it yourself »  It is not recommended to underline text that is not a link, as this often confuses users. Text Transformat ion 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.uppercase {text-transform:uppercase;} p.lowercase {text-transform:lowercase;} p.capitalize {text-transform:capitalize;} Try it yourself » Text Indentation The text-indentation property is used to specify the indentation of the first line of a text. Example p {text-indent:50px;} Try it yourself » More Examples Specify the space between characters Thi s exampl e de monstr ates how to incr ease or decrease the space betw een characters. Speci fy the space betwee n lines Thi s exampl e de monstr ates how to specify t he 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 betwe en words Thi s exampl e demonstrates how to increase the white space betw een w ords in a paragraph. Disable text wrapping inside an element This example demonstrates how to disable text wrapping inside an element. Vertical ali gnment o f an image This example demonstrates how to set the vertical align of an image in a text. All CSS Text Properties The number in the "CSS" column indicates in w hich CSS v ersion the property is de fined (CSS1 or CSS2). 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 betw een characters normal length 1 text-align Aligns the text in an element left right center  just ify 1 text-decoration Adds decoration to text none underline 1

description

ctp

Transcript of CSS Text Properties

  • 1/10/14 CSS Text

    file:///E:/Document/W3School/W3schools Offline Version/www.w3schools.com/css/css_text.asp 2/3

    Example

    h1 {text-decoration:overline;}h2 {text-decoration:line-through;}h3 {text-decoration:underline;}h4 {text-decoration:blink;}

    Try it yourself

    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 ofeach word.

    Example

    p.uppercase {text-transform:uppercase;}p.lowercase {text-transform:lowercase;}p.capitalize {text-transform:capitalize;}

    Try it yourself

    Text Indentation

    The text-indentation property is used to specify the indentation of the first line of a text.

    Example

    p {text-indent:50px;}

    Try it yourself

    More Examples

    Specify the space between charactersThis example demonstrates how to increase or decrease the space between characters.

    Specify the space between linesThis example demonstrates how to specify the space between the lines in a paragraph.

    Set the text direction of an elementThis example demonstrates how to change the text direction of an element.

    Increase the white space between wordsThis example demonstrates how to increase the white space between words in a paragraph.

    Disable text wrapping inside an elementThis example demonstrates how to disable text wrapping inside an element.

    Vertical alignment of an imageThis example demonstrates how to set the vertical align of an image in a text.

    All CSS Text Properties

    The number in the "CSS" column indicates in which CSS version the property is defined (CSS1 orCSS2).

    Property Description Values CSS

    color Sets the color of a text color 1

    direction Sets the text direction ltrrtl

    2

    line-height Sets the distance between lines normalnumberlength%

    1

    letter-spacing Increase or decrease the space betweencharacters

    normallength

    1

    text-align Aligns the text in an element leftrightcenterjustify

    1

    text-decoration Adds decoration to text noneunderline

    1

  • 1/10/14 CSS Text

    file:///E:/Document/W3School/W3schools Offline Version/www.w3schools.com/css/css_text.asp 3/3

    overlineline-throughblink

    text-indent Indents the first line of text in an element length%

    1

    text-shadow none

    colorlength

    text-transform Controls the letters in an element nonecapitalizeuppercaselowercase

    1

    unicode-bidi normalembedbidi-override

    2

    vertical-align Sets the vertical alignment of an element baselinesubsupertoptext-topmiddlebottomtext-bottomlength%

    1

    white-space Sets how white space inside an element is handled normalprenowrap

    1

    word-spacing Increase or decrease the space between words normallength

    1

    Previous Next Chapter

    Product Spotlight

    HO ME | TO P | PRINT | FO RUM | A BO UT

    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 warrent full correctnes of all content.

    While using this site, you agree to have read and accepted our terms of use and privacy policy.Copyright 1999-2011 by Refsnes Data. All Rights Reserved.