1. CSS Margins
▶ With CSS, you have full control over the margins. There are properties for setting the margin for each side of an element (top, right, bottom, and left).
hello
2. CSS Padding
▶ Padding-bottom
▶ Padding-right
▶ Padding-left
1. CSS Text
- CSS has a lot of properties for formatting text.
- Text Color : This property is used to set the color of the text.
- The color is specified by
- body { color : red; }
- This property is used to set the horizontal alignment of a text.
- A text can be left or right aligned, centered, or justified.
H1{
2.Text-Decoration:
- Underline: A line beneath the text, often used for emphasis or hyperlinks.
- Example:
- CSS:
text-decoration: underline;
Overline: A line placed above the text, though less commonly used than underlining.
- Example: This is overlined text.
- CSS:
text-decoration: overline;
None: Removes any text decoration, often used to remove default link underlines.
- CSS:
text-decoration: none;
3.Text Transformation
Text transform refers to the CSS property that changes the capitalization or appearance of text. It’s commonly used to control how text is displayed without altering the underlying HTML or actual content. The most commonly used text-transform
values are:
Uppercase: Converts all letters to uppercase (capital) letters.
- Example: THIS IS UPPERCASE TEXT.
- CSS:
text-transform: uppercase;
Lowercase: Converts all letters to lowercase.
- Example: this is lowercase text.
- CSS:
text-transform: lowercase;
Capitalize: Capitalizes the first letter of each word.
- Example: This Is Capitalized Text.
- CSS:
text-transform: capitalize;
None: Keeps the text as it is, without changing its capitalization.
- Example: This is default text.
- CSS:
text-transform: none;
This property is helpful for applying styling that needs to conform to a specific format, such as titles or labels.
1. letter-spacing
- Definition: Specifies the space between characters in a text. You can control how much space is added between letters.
- Syntax:
Theletter-spacing: value;
value
can be in units likepx
,em
,rem
, etc. Positive values increase the space, while negative values decrease it. - Example:
This increases the space between characters by 2 pixels.p {letter-spacing: 2px; }
2. line-height
- Definition: Specifies the height of a line. It's useful for controlling the spacing between lines of text.
- Syntax:
Theline-height: value;value
can be a number (multiplier of the font size), a unit (e.g.,px
,em
), or a percentage. - Example:
This sets the line height to 1.5 times the size of the text.p {line-height: 1.5; }
3. text-indent
- Definition: Specifies the indentation of the first line in a block of text.
- Syntax:
Thetext-indent: value;value
can be in units likepx
,em
, or percentages. - Example:
This indents the first line of a paragraph by 30 pixels.p { text-indent: 30px; }
4. white-space
- Definition: Specifies how white-space inside an element is handled. It controls whether white-space characters like spaces, tabs, and newlines should be treated as part of the content or ignored.
- Syntax:white-space: normal | nowrap | pre | pre-wrap | pre-line;
- Example:
This prevents the text from wrapping and keeps it on a single line.p { white-space: nowrap; }
5. word-spacing
- Definition: Specifies the space between words in a text.
- Syntax:
Theword-spacing: value;
value
can be in units likepx
,em
,rem
, etc. - Example:
This increases the space between words by 5 pixels.p { word-spacing: 5px; }
0 Comments