# CSS Text

# ****CSS Text****

CSS has a lot of properties for formatting text.

**Text Color and Background Color👇**
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669800774177/eS0rqtiBT.png align="left")

**CSS Text Alignment**

The `text-align` property is used to set the horizontal alignment of a text. ( left alignment is default )

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669800796862/S1t5-lPYt.png align="left")

Example of right alignment👇 

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669800817510/-DA2d0w4_.png align="left")

Example of justify alignment👇

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669800836198/CBVItuAq0.png align="left")
# Text Align Last

The `text-align-last` property specifies how to align the last line of a text.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669800854904/Xri8LZku-.png align="left")

# Vertical Alignment

The `vertical-align` property sets the vertical alignment of an element.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669800877249/nL-zeUy6y.png align="left")

Example of vertical-align : middle👇 


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669800898721/LUjXv1Djm.png align="left")

# **CSS Text Decoration**

Here, we will discuss the following topics👇

- `text-decoration-line`
- `text-decoration-color`
- `text-decoration-style`
- `text-decoration-thickness`
- `text-decoration`

## 1. text-decoration-line👇

The `text-decoration-line` property is used to add a decoration line to the text.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669800998701/MnRqobAU9.png align="left")
Example👇 

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669801018534/gYYb_jEST.png align="left")

## 2. text-decoration-color👇

The `text-decoration-color` property is used to set the color of the decoration line.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669801043830/vaNBFC1sZ.png align="left")

# 3. text-decoration-style👇

The `text-decoration-style` property is used to set the style of the decoration line.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669801067887/KkQAOYx-e.png align="left")

Example 👇
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669801096673/BWCpONQc0.png align="left")

## 4. text-decoration-thickness👇

The `text-decoration-thickness` property is used to set the thickness of the decoration line.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669801117492/2FXqPelSj.png align="left")
Example 👇
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669801138389/VCeuTi8SE.png align="left")

# The Shorthand Property

The `text-decoration` property is a shorthand property for:

- `text-decoration-line` (required)
- `text-decoration-color` (optional)
- `text-decoration-style` (optional)
- `text-decoration-thickness` (optional)


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669801158402/lTYlXL9Gt.png align="left")

# **CSS Text Spacing**

Here, we will discuss the following topics👇

- `text-indent`
- `letter-spacing`
- `line-height`
- `word-spacing`
- `white-space`

# Text Indentation

The `text-indent` property is used to specify the indentation of the first line of a text:
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669801225247/UvXp4eeZT.png align="left")
Example of text-indent 👇


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669801248583/ra7yPeYYN.png align="left")

# Letter Spacing

The `letter-spacing` property is used to specify the space between the characters in a text.
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669801271032/9J64RGlV3.png align="left")

Example of Letter spacing👇
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669801292963/HnBkJLcev.png align="left")

# Line Height👇

The `line-height` property is used to specify the space between lines.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669866996693/fZFC20guP.png align="left")
Example of line-height👇
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669867030217/Z2m9YQtLK.png align="left")

# Word Spacing

The `word-spacing` property is used to specify the space between the words in a text.
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669867066740/OKPeDP0uP.png align="left")
Example of word spacing👇 
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669867095784/oPPUdFzCs.png align="left")

# White Space

The **`white-space`** CSS property sets how white space inside an element is handled.
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669867132924/3YbFb34o6.png align="left")

Example of white space👇
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669867154008/EqiDQUP4E.png align="left")
white-space Property👇

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1669867177387/TunzE7sih.png align="left")


-----------------------------------------------------------------------------------------------
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1666336375150/5HqI8zNVh.png align="left")> 
Download our HTML & CSS Visual Treat! ebook Here: 
[Click here](https://codemarch.gumroad.com/l/hxazr)

