Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Definition and Application of CSS rules

Shulou Source: shulou.com Published: 2022-06-02 04:44:44 10月02日 Update

This article mainly explains "the definition and application of CSS rules". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's ideas to study and learn "the definition and application of CSS rules".

How to link CSS files

Additional links: external CSS fil

Import CSS: when you often apply multiple CSS files, import multiple CSS into a single CSS file

There are three CSS rule definitions:

1) classes such as ".RedText", ".BlueText", ".BigText" and so on

2) the tag redefines the CSS of the original HTML tag

3) High-level pseudo classes, elements that define ID, and comprehensive definitions

Application of CSS rules

Only "class" styles need to be applied, class= "xxxx". Classes can be applied to any element.

The difference between class and id

Tag applications are generally used one-time for "body" tags, and definitions are not recommended for tags such as "li" and "td" that are repetitive on the page.

Advanced multi-use, defining "# id li" is much better than defining "li".

The order in which CSS rules are executed

In the order in which the CSS code is executed

If there are duplicate rules, follow the definition executed later

The final rule is the synthesis of multiple defining rules.

Key point: advanced rule definition

1. Text style definitions for different tables. (different tables use different ID and class style definitions)

two。 Multiple hyperlink style definitions on one page

3. Common definition of multiple CSS for different objects with the same rule

4. Which is more scientific to consider for multiple CSS approaches to the same object definition (extensibility and code simplicity)

Thank you for your reading, the above is the content of "definition and Application of CSS rules". After the study of this article, I believe you have a deeper understanding of the definition and application of CSS rules, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Rules applications tags different multiple files styles advanced links learning code elements content multiple objects ways tables order synthesis same Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Information MariaDB Apple Huawei