Home > Web Front-end > CSS Tutorial > What are the text attributes in css

What are the text attributes in css

王林
Release: 2020-11-18 17:10:42
Original
4751 people have browsed it

The text attributes in css are: 1. Color attribute color; 2. Text alignment attribute text-align; 3. Decoration text attribute text-decoration; 4. Text indent attribute text-indent; 5. Line Spacing attribute line-height.

What are the text attributes in css

The text attributes in css are:

(Learning video sharing: css video tutorial)

1. Text color

The color attribute is used to define the color of text

div {
color:red;
}
Copy after login

What are the text attributes in css

The most commonly used in development is hexadecimal

2. Align text

The text-align attribute is used to set the horizontal alignment of the text content within the element

div {
text-align:center;
}
Copy after login

What are the text attributes in css

3 , Decorate text

The text-decoration attribute specifies the modifications added to the text. You can add underline, strikethrough, overline, etc. to the text.

div {
text-decoration:underline;
}
Copy after login

What are the text attributes in css

4. Text indent

The text-indent attribute is used to specify the indent of the first line of text, usually the paragraph The first line is indented.

div {
text-indent:10px;
}
Copy after login

By setting this attribute, the first line of all elements can be indented by a given length, even the length can be a negative value.

p {
text-indent:2em;
}
Copy after login

em is a relative unit, which is the size of one text of the current element (font-size). If the current element does not set a size, it will be the size of one text of the parent element.

5. Line spacing

The line-height property is used to set the distance between lines (line height), which can control the distance between lines of text.

p {
line-height:26px;
}
Copy after login

Related recommendations: CSS tutorial

The above is the detailed content of What are the text attributes in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template