Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the rules for the use of CSS style

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about the rules for the use of CSS styles. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

One: the description of CSS

1. CSS is commonly referred to as CSS style or cascading style sheet, which is mainly used to set the text content (font, size, how to it, etc.) in the HTML page.

2. appearance display styles such as the shape of the picture (height and width, border style, margin, etc.) and the layout of the layout

3. CSS can make HTML pages look better, and the collocation of CSS colors can make users more comfortable.

4. The layout of CSS+DIV is more flexible, and it is easier to draw the structure that users need.

Two: rules for the use of CSS style

1. When using HTML, you need to follow certain specifications, and so does CSS.

2. Grammatical interpretation

The selector is used to specify the HTML object that the CSS style acts on

In parentheses is the specific style set for the object

Attributes and attribute values are presented as key-value pairs, separated by colons ":"

Use English semicolons between multiple attributes ";"

Third: the characteristics of CSS style

1. The "selector" is strictly case-sensitive

2. "attribute" and "attribute value" are not case sensitive

3. Multiple attributes are separated by an English semicolon, and the semicolon of the last attribute can be omitted (it is recommended that it be easy to read)

4. In order to improve the reading of CSS style and the abbreviated typesetting of CSS style with comments

Four: the introduction of CSS style

1. CSS is very flexible to use and can be embedded in HTML.

2. It is also a separate file. If it is a separate file, .css must be the extension.

Five: a common way

1. Inline style

1. Inline style, which sets the style of the element through the style attribute of the tag

2. Inline style controls the style through the attributes of the tag, and does not separate the structure from the presentation (HTML structure, CSS display) (less used)

2. Internal style (embedded)

1. Unload the tag body of the HTML document in the CSS code set, and use the definition to style multiple tags of the current html

2, embedded CSS style is only valid for the HTML page, it is a good choice to design a web page, but it is not appropriate to design a website, because it can not give full play to the reuse of CSS code at the same time.

3. External style

1. The external style is also called chained type.

2. Put all styles in one or more external stylesheet files

3. Connect the style to the HTML file through tags

4. Priority

1. Inline style > internal style (embedded) > external style

Thank you for reading! This is the end of this article on "what are the rules for the use of CSS style?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report