CSS Text Spacing

CSS text spacing refers to the space between characters, words, and lines of text. You can control the spacing of text in CSS using the following properties:


letter-spacing

This property adjusts the spacing between characters in a text string. It accepts a length value (e.g., pixels, em, %,etc.) or a unitless value to increase or decrease the space between letters.

Example
Try yourself
        
            p {
   letter-spacing: 2px;
}
        
    

word-spacing

Similar to letter-spacing, this property controls the spacing between words in a text string. It accepts a length value or a unitless value to increase or decrease the space between words.

Example
Try yourself
        
            p {
   word-spacing: 5px;
}
        
    

line-height

This property determines the height of each line of text. It accepts a length value, a unitless value, or a percentage value to adjust the spacing between lines.

Example
Try yourself
        
            p {
   line-height: 1.5;
}
        
    

text-indent

This property specifies the indentation of the first line of text within a block-level element. It accepts a length value or a percentage value to control the amount of indentation.

Example
Try yourself
        
            p {
   text-indent: 20px;
}
        
    

white-space

This property determines how white space characters are handled within a text string. It can be used to control line breaks and collapsing of multiple white spaces.

Example
Try yourself
        
            p {
   white-space: nowrap;
}
        
    

These are some commonly used CSS properties for text spacing. By adjusting these properties, you can achieve the desired spacing and layout for your text content on a webpage.