Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the inheritance, cascading and particularity of CSS?

Shulou Source: shulou.com Published: 2022-06-01 06:23:57 09月29日 Update

This article mainly explains "what is the inheritance, cascading and particularity of CSS". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the inheritance, cascading and particularity of CSS".

Some styles of CSS are inherited, and inheritance is a rule that allows styles to be applied not only to a particular HTML tag element, but also to its descendants.

Particularity: different selectors have different weights, the weight of the label is 1, the weight of the class selector is 10, the maximum weight of the ID selector is 100.

Cascading means that there can be multiple CSS styles for the same element in the HTML file. When styles with the same weight exist, they will be determined according to the order of these CSS styles, and the CSS style at the end will be applied.

CSS formatted typesetting

Text typesetting

Font, body {font-family: "Microsoft Yahei";}

Font size, color, body {font-size:12px;color:#666}

Bold, body {font-weight:bold;}

Italic, body {font-style:italic;}

Underscore, body {font-style:italic;}

Delete line, body {text-decoration:line-through;}

Paragraph typesetting

Indent, p {text-indent:2em;}

Line spacing (row height), p {line-height:1.5em;}

Chinese character spacing, letter spacing, letter-spacing:50px; and word-spacing:50px

Alignment, div {text-align:center;}

Thank you for your reading, the above is the content of "what is the inheritance, cascading and particularity of CSS". After the study of this article, I believe you have a deeper understanding of what is the inheritance, cascading and particularity of CSS. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Style special particularity learning application selection different element content that is text label spacing highest same underline descendant appliance multiple font Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Shulou Tech Info Apple Redmi Shulou Technology