Typography plays a crucial role in the way text is arranged and presented. It holds significant importance for your website as it provides users with a clear view and enhances their ability to read it accurately.
Here are some of the following topics related to typography or font properties that I learned today:
text-decoration
The
text-decoration
property in CSS is used to add visual effects to the text, such as underlines, overlines, line-throughs, and blinking text. It allows you to customize the appearance of text elements and add decorative elements to enhance the overall visual presentation of your website.Here are some common values that can be used with the
text-decoration
property:none
: This value removes any text decorations.underline
: This value adds a line underneath the text.overline
: This value adds a line above the text.line-through
: This value adds a line through the middle of the text.blink
: This value makes the text blink on and off.
text-transform
The text-transform
property in CSS is used to control the capitalization or case of the text within an element. It allows you to transform the text into various forms, such as making it all uppercase, all lowercase, or capitalizing the first letter of each word.
Here are the different values that can be used with the text-transform
property:
none
(default): Specifies that no capitalization or case transformation is applied to the text.
uppercase
: Transforms the text to all uppercase letters.
lowercase
: Transforms the text to all lowercase letters.
capitalize
: Capitalizes the first letter of each word in the text.
initial
: Sets the text-transform
property to its default value, which is none
.
inherit
: Inherits the text-transform
property from its parent element.
text-align
The text-align
property in CSS is used to specify the alignment of text within its containing element. It allows you to control the horizontal alignment of text, such as left, right, center, or justify.
text-indent
The text-indent
property in CSS is used to control the indentation of the first line of a block-level element. It allows you to specify the amount of space to add before the first line of text in a paragraph or a block of text.
line-height
The line-height
property can also accept other values, such as:
Normal: This is the default value and sets the line height to the browser's default value, typically around 1.2.
Number: You can specify a number value, which is multiplied by the font size to determine the line height.
Length: You can use a fixed length value, such as pixels, to set an exact line height.
Percentage: You can specify a percentage value relative to the font size to set the line height.
letter-spacing
The letter-spacing
property in CSS is used to control the spacing between characters (letters) in a block of text. It allows you to adjust the amount of space between each character, both increasing and decreasing the spacing.
word-spacing
The word-spacing
property in CSS is used to control the spacing between words in a block of text. It allows you to adjust the amount of space between each word, increasing or decreasing the spacing.
font-weight
The font-weight
property accepts various values, including:
normal
: Sets the default or normal weight of the text.bold
: Makes the text bold or thicker.bolder
: Increases the font weight relative to the parent element.lighter
: Decreases the font weight relative to the parent element.Numeric values (100 to 900): Allows you to specify the exact font weight using numeric values. Multiple of 100 (e.g., 100, 200, 300) are commonly used.
font-style
The font-style
property in CSS is used to specify the style of the text in a text element. It allows you to control the visual appearance of the text, such as italic or normal.
font-family
The font-family
property accepts multiple font names, separated by commas. The browser will attempt to use the first font in the list and, if not available, move on to the next one. It's recommended to provide a generic font family as the last option to ensure that a suitable font is always rendered.
Here are a few examples of font families you can use:
Specific font family:
"Arial"
,"Helvetica"
,"Times New Roman"
,"Courier New"
, etc.Generic font family:
serif
,sans-serif
,monospace
,cursive
,fantasy
.