Text Formatting Techniques for Readability
line-height
The line-height property defines the height of a line and is often used to adjust the space between lines of text. By default, line-height depends on the text font and is determined by the browser.
line-height: multiplier | value in px | value in em | percent
multiplieris a value without units (e.g.,1.5). In this case, the line height will be the value that is1.5greater than thefont-sizevalue;value in pxis a specific value (e.g.,24px) to which the line height will be equal;value in emis a value (e.g.,1.4em) that works similarly to themultiplier. The browser will check thefont-sizevalue, multiply that value by1.4, and this result will be the line height;percentis a value (e.g.,120%) that functions like amultiplier. Thefont-sizevalue will be multiplied by1.2, determining the line height value.
index.html
styles.css
Output
letter-spacing
The letter-spacing property sets the horizontal spacing between text characters.
letter-spacing: normal | value in px | value in em
normalis the default spacing between characters;value in pxis a specific value that adds extra space between characters;value in emworks similarly to px, but the spacing is relative to thefont-size.
index.html
styles.css
Output
word-spacing
The word-spacing property defines the distance between words in the text. It increases the space between words. If there are any punctuation marks in the text, and they are written with words, then they will still be written together, as there is no space between them.
word-spacing: value | inherit | normal
valueis a specific value that sets the space between words;inheritinherits the word spacing from the parent element;normalis the default spacing between words.
index.html
styles.css
Output
text-shadow
The text-shadow property adds a shadow to the text.
text-shadow: "X set" | "Y set" | "blur radius" | "color"
X setadjusts the horizontal position of the shadow. Positive values move the shadow to the right, and negative values move it to the left;Y setadjusts the vertical position of the shadow. Positive values move the shadow downward, and negative values move it upward;blur radiusdefines how blurry the shadow appears. Higher values make the shadow softer and more diffused. The default value is0if not specified;colorspecifies the shadow's color in any valid color format. If not specified, it defaults to the text color.
index.html
styles.css
Output
Note
In text formatting, there are no strict rules dictating which values must be used in specific situations. The choice of text formatting properties and values depends on the unique requirements of each project and the design vision.
1. Which CSS property is used to create a visual effect that adds a shadow to text?
2. Which CSS property adjusts the distance between words in a text?
Thanks for your feedback!
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Can you explain the difference between line-height, letter-spacing, and word-spacing?
How do I choose the right values for these text properties in my project?
Can you show more examples of using text-shadow with different colors or effects?
Awesome!
Completion rate improved to 2.56
Text Formatting Techniques for Readability
Swipe to show menu
line-height
The line-height property defines the height of a line and is often used to adjust the space between lines of text. By default, line-height depends on the text font and is determined by the browser.
line-height: multiplier | value in px | value in em | percent
multiplieris a value without units (e.g.,1.5). In this case, the line height will be the value that is1.5greater than thefont-sizevalue;value in pxis a specific value (e.g.,24px) to which the line height will be equal;value in emis a value (e.g.,1.4em) that works similarly to themultiplier. The browser will check thefont-sizevalue, multiply that value by1.4, and this result will be the line height;percentis a value (e.g.,120%) that functions like amultiplier. Thefont-sizevalue will be multiplied by1.2, determining the line height value.
index.html
styles.css
Output
letter-spacing
The letter-spacing property sets the horizontal spacing between text characters.
letter-spacing: normal | value in px | value in em
normalis the default spacing between characters;value in pxis a specific value that adds extra space between characters;value in emworks similarly to px, but the spacing is relative to thefont-size.
index.html
styles.css
Output
word-spacing
The word-spacing property defines the distance between words in the text. It increases the space between words. If there are any punctuation marks in the text, and they are written with words, then they will still be written together, as there is no space between them.
word-spacing: value | inherit | normal
valueis a specific value that sets the space between words;inheritinherits the word spacing from the parent element;normalis the default spacing between words.
index.html
styles.css
Output
text-shadow
The text-shadow property adds a shadow to the text.
text-shadow: "X set" | "Y set" | "blur radius" | "color"
X setadjusts the horizontal position of the shadow. Positive values move the shadow to the right, and negative values move it to the left;Y setadjusts the vertical position of the shadow. Positive values move the shadow downward, and negative values move it upward;blur radiusdefines how blurry the shadow appears. Higher values make the shadow softer and more diffused. The default value is0if not specified;colorspecifies the shadow's color in any valid color format. If not specified, it defaults to the text color.
index.html
styles.css
Output
Note
In text formatting, there are no strict rules dictating which values must be used in specific situations. The choice of text formatting properties and values depends on the unique requirements of each project and the design vision.
1. Which CSS property is used to create a visual effect that adds a shadow to text?
2. Which CSS property adjusts the distance between words in a text?
Thanks for your feedback!