Skip to content
  • Quizes
  • QStack
  • Blog
  • pinterest
  • instagram
  • twitter
  • linkedin
  • facebook
W3 Coding Schools
  • Home
  • HTML
    • HTML Introduction
    • HTML Editors
    • Fundamentals of HTML
    • Elements of HTML
    • HTML Attributes
    • HTML Headings
    • HTML Paragraphs
    • HTML Style Attribute
    • HTML Text Formatting
    • HTML Phrase Tags
    • HTML Comments
    • HTML with CSS
    • HTML Links
    • HTML Images
    • HTML Tables
    • HTML Lists
    • HTML Blocks
    • HTML Class Attribute
    • HTML Id Attribute
    • HTML Iframes
    • HTML JavaScript
    • HTML File Paths
    • HTML Head
    • Computer Code Elements
    • HTML Entities
    • HTML Charset
    • HTML URL Encode
    • HTML and XHTML
    • HTML Layouts
    • HTML Forms
    • HTML Form Elements
    • HTML Form Input Types
    • HTML Input Attributes
    • HTML5 Introduction
    • HTML5 New Elements
    • Semantic Elements
    • HTML5 Migration
    • Style Guide
    • HTML Canvas
  • CSS
    • CSS Introduction
    • CSS Syntax and CSS Comments
    • CSS Selectors
    • How to add CSS to a Webpage
    • CSS Color Basics
    • CSS Background Properties
    • CSS Border Properties
    • CSS Margin and Padding Properties
    • CSS Height and Width properties
    • CSS Box Model
    • CSS Outline Properties
    • CSS Fonts
    • CSS Text
    • How To Add Icons
    • CSS Links
    • CSS List-Style
    • CSS Tables
    • CSS Display Property
    • CSS Position Property
    • CSS Overflow Property
    • CSS max-width Property
    • CSS Float and Clear Properties
    • CSS Alignment
    • CSS inline-block
    • CSS Combinators
    • CSS Pseudo Classes
    • CSS Pseudo Elements
    • CSS Opacity
    • CSS Navigation Bar
    • CSS Dropdowns
    • CSS Image Gallery
    • CSS Image Sprites
    • CSS Attribute Selector
    • CSS Styling Forms
    • CSS Counters
    • CSS Units
    • CSS Specificity
    • CSS Website Layout
    • CSS Rounded Corners
    • CSS Border Image Property
    • CSS Multiple Backgrounds
    • CSS Gradient
    • CSS Shadow Effects
    • CSS Text Effects
    • CSS Web Fonts
    • CSS 2D Transforms
  • Bootstrap 4
    • Bootstrap 4 – Introduction
    • Bootstrap versions
    • Bootstrap 4 Layout
    • Bootstrap 3 Vs Bootstrap 4
    • Bootstrap 4 Grid System
    • Bootstrap 4 Typography
    • Bootstrap 4 Colors
    • Bootstrap 4 Images
    • Bootstrap 4 Tables
    • Bootstrap 4 Jumbotron
    • Bootstrap 4 Figures
    • Bootstrap 4 Alerts
    • Bootstrap 4 Buttons
    • Bootstrap 4 Button Group
    • Bootstrap 4 Badges
    • Bootstrap 4 Spinners
    • Bootstrap 4 Progress Bars
    • Bootstrap 4 Pagination
    • Bootstrap 4 Breadcrumbs
    • Bootstrap 4 List Groups
    • Bootstrap 4 Cards
  • jQuery
    • jQuery Introduction
    • jQuery Download
    • jQuery Selectors
    • jQuery Event Methods
    • jQuery Hide/Show Effects
    • jQuery Fading Effects
    • jQuery Sliding Effects
    • jQuery Animation
    • jQuery Stop and Callback
    • jQuery Get and Set Methods
    • jQuery Chaining
    • jQuery Add
    • jQuery Remove
    • jQuery CSS Classes
    • jQuery Style Properties
    • jQuery Dimensions
    • jQuery Traversing
    • jQuery Ancestors
    • jQuery Descendants
    • jQuery Siblings
  • Javascript
    • JS Introduction
    • JS Where to Put
    • JavaScript Syntax
    • JavaScript Comments
    • JavaScript Variables
    • JavaScript Data Types
    • JavaScript Operators
    • JavaScript Events
    • JavaScript Strings
    • JavaScript Numbers
  • php
    • PHP Introduction
    • Install PHP
    • PHP Syntax and Comments
    • PHP Variables
    • PHP Constants
    • PHP Echo and Print
    • PHP Data Types
    • PHP Strings
    • PHP Operators
    • PHP $ and $$ Variables
  • WordPress
    • WordPress Introduction
    • WordPress History
    • WordPress.com vs WordPress.org
    • How to Install WordPress
    • WordPress Dashboard
    • How to Create a WordPress Website
    • WordPress Posts
    • WordPress Pages
    • WordPress Posts vs Pages
    • WordPress Categories
  • SEO
    • SEO Introduction
    • SEO Tactics and Methods
    • SEO Relevant Filenames
    • SEO Domain Name
    • Website Design and SEO
    • SEO Keywords
    • Meta Tags Optimization
    • Title Tag Optimization
    • Anchor Text Optimization
    • Content Optimization
  • Android
    • Android Introduction
    • Android History and Versions
    • Android Architecture
    • Android Environment Setup
    • Android Application Components
    • Hello World Application
    • Android Activities
  • iOS
    • iOS Introduction
    • iOS Environment Setup
    • iOS Architecture

You Are Here

  • Home
  • Learn CSS
  • CSS Text

Topics

  • CSS Introduction
  • CSS Syntax and CSS Comments
  • CSS Selectors
  • How to add CSS to a Webpage
  • CSS Color Basics
  • CSS Background Properties
  • CSS Border Properties
  • CSS Margin and Padding Properties
  • CSS Height and Width properties
  • CSS Box Model
  • CSS Outline Properties
  • CSS Fonts
  • CSS Text
  • How To Add Icons
  • CSS Links
  • CSS List-Style
  • CSS Tables
  • CSS Display Property
  • CSS Position Property
  • CSS Overflow Property
  • CSS max-width Property
  • CSS Float and Clear Properties
  • CSS Alignment
  • CSS inline-block
  • CSS Combinators
  • CSS Pseudo Classes
  • CSS Pseudo Elements
  • CSS Opacity
  • CSS Navigation Bar
  • CSS Dropdowns
  • CSS Image Gallery
  • CSS Image Sprites
  • CSS Attribute Selector
  • CSS Styling Forms
  • CSS Counters
  • CSS Units
  • CSS Specificity
  • CSS Website Layout
  • CSS Rounded Corners
  • CSS Border Image Property
  • CSS Multiple Backgrounds
  • CSS Gradient
  • CSS Shadow Effects
  • CSS Text Effects
  • CSS Web Fonts
  • CSS 2D Transforms

Oct Champs & Prizes

  • 1. Pooja Ladda
  • 2. Manjali Kuldharan
  • 3. Pranali Surawar
  • 4. Anjali Kulkarni
  • 5. Vishal Deshmukh

Recent Posts

  • HTML Media
  • jQuery Siblings
  • Bootstrap 4 Cards
  • jQuery Descendants
  • jQuery Ancestors

CSS Text

Apart from the various CSS font properties, there are other properties that can use to style your text.
For example, you can change the color of text, align text, add decoration properties and many more.
Following are the CSS text properties:

Text Color

The color property is defined to set the color of the text.
Text-color can be set by using the name “blue”, hex value “#0000ff” or by its RGB value “rgb( 0, 0, 255)”.

Example:

h1 {

color: blue;

}

h2 {

color: #0000ff;

}

p {

color: rgb(0,0,255);

}
Try it

Text Alignment

The text-align property is defined to set the horizontal alignment of a text.
The values for this property are: left, right, center, justify, and inherit.

Example:

h1 {

text-align: center;

}

h2 {

text-align: left;

}

p {

text-align: right;

}
Try it
In justified alignment, the line is stretched so that every line has equal width, and the left and right margins are straight.

Example:

div {

text-align: justify;

}

Try it

Text Decoration

Text decoration property is used to add or remove decorations from the text.
By using underline, overline, and line-through you can add the decoration. And set “none” to remove the decoration.

Example:

h1 {

text-decoration: underline;

}

h2 {

text-decoration: overline;

}

h3 {

text-decoration: line-through;

}

p {

text-decoration: none;

}
Try it

Text Transformation

Text transformation property is used to set the case of text, uppercase or lowercase.
Text transformation can be uppercase, lowercase or capitalize.
Capitalize is used to change the first letter of each word to uppercase.

Example:

h1 {

text-transform: uppercase;

}

h2 {

text-transform: lowercase;

}

h3 {

text-transform: capitalize;

}

Try it

Text Indentation

The text-indent property is defined to set the indentation of the first line of text of an element.
You can give the values for the text-indent property are: percentage (%), length (specifying indent space) or inherit.

Example:

div {

text-indent: 30px;

}

Try it

Word Spacing

The word-spacing property is used to set the spacing between the words.

Example:

p {

word-spacing: 15px;

}

Try it

Letter Spacing

The letter-spacing property is used to add or subtract space between the characters of the text.

Example:

h1 {

letter-spacing: 10px;

}

p {

letter-spacing: -5px;

}

Try it

Line Height

The CSS line-height property is used to set the height of a line of text.
Negative values for this property are not allowed.

Example:

h1 {

line-height: 1.2;

}

p {

line-height: 0.8;

}

Try it

Text Direction

The direction property is used to specify the text direction of an element

Example:

In this example, “rtl” is right to left direction and “ltr” is left to right direction.
h1 {

direction: rtl;

}

h2 {

direction: ltr;

}

Try it

Text Shadow

The text-shadow property is used to add the shadow to text.

Example:

In this example, 2px is the position of the horizontal shadow, 1px is the position of the vertical shadow and blue is the color of the shadow.
h1 {

text-shadow: 2px 1px blue;

}

Try it

White Space

The white-space property describes how white-space inside an element is handled.
The possible values are: normal, nowrap, pre, pre-line, pre-wrap, initial, inherit.

Example:

p.normal {

white-space: normal;

}

p.pre {

white-space: pre;

}

p.nowrap {

white-space: nowrap;

}

Try it

Vertical Align

The vertical-align property is used to set the vertical alignment of an element. By using this property, you can set an image position as middle, top, bottom, etc.
The possible values are: baseline, top, bottom, middle, sub, super, text-top, text-bottom, initial, inherit, and you can give the length also.

Example:

img.baseline {

vertical-align: baseline;

}

img.sub {

vertical-align: sub;

}

img.super {

vertical-align: 10px;

}

Try it

Post navigation

CSS Fonts
How To Add Icons

Ask a Question Cancel reply

Your email address will not be published. Required fields are marked *

W3 CODING SCHOOLS © Copyright 2019-20
Privacy policy   Terms of use

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok