The zero-based HTML tutorial CSS article (3): Commonly used font and text attributes

Source: Internet
Author: User

First, CSS commonly used font properties

1. Font settings

Fonts are set by the Font-family property in the CSS.

Font-family: "Bold";

2. Size of the font

Use Font-size to set the size of the text font-size:16px; PX is a unit of length, 1px means 1 pixel size with color set text color

3. Color of the font

Color:black; Color: #FFFFFF;

Color:rgb (255,255,000);

Color:rgb (0%,100%,100%);

Colors can be expressed in English words, hexadecimal codes, and RGB.

Ii. properties of commonly used text

1. Line Spacing

To set line spacing with the Line-height property

line-height:20px;

Line-height:2;

20px indicates that the line spacing is 20 pixel size, and the number with no units only digits is a multiple of the font size. If the font size is 16px, 2 of the line spacing is 40px.

2. First Line Indent

Use Text-indent to represent the first line indent

text-indent:30px;

3. Text alignment

Use Text-align to set the alignment of text

Text-align:left;

Text-align:right;

Text-align:center;

text-align:justify;

Left is right-aligned, right is right-aligned, center is centered. The justify is to align both ends, adjusting the spacing between the words and letters so that the lines are exactly equal in length.

4. The decoration of the text

To decorate text with the Text-decoration property

Text-decoration:none;

Text-decoration:underline;

Text-decoration:overline;

Text-decoration:line-through;

Text-decoration:blink;

None is to cancel the Decoration property, underline add an underscore, overline add a line at the top of the text, Line-through a line in the middle of the text, and blink make the text blink.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.