In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "what are the three characteristics of CSS". In daily operation, I believe many people have doubts about what the three characteristics of CSS are. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts about "what are the three characteristics of CSS?" Next, please follow the editor to study!
I. inheritance
Set some attributes to the parent element, and the child element can also be used, which we call inheritance.
Note to :
Not all properties of can be inherited, only those that begin with color/font-/text-/line- can inherit
In the inheritance of CSS, can be inherited not only by sons, but also by descendants.
The particularity of inheritance
The text color and underscore of the a label cannot be inherited
The text size of the h tag cannot be inherited
Inheritance is generally used to set public information on a web page, such as page text color, font, and size.
2. Cascading
Cascading is the ability of CSS to handle conflicts.
cascading occurs only if "same tag" is selected in multiple selectors, and then "same property" is set.
Cascading is determined by priority.
Indirect selection refers to inheritance.
Priority judgment method:
1. Indirect selection is inheritance, and whoever is close to the target tag listens to him.
two。 Select indirectly and listen to whoever is close to the target tag.
3. When it is directly selected, and when it is the same type of selector, whoever writes after it will listen to it. When it is a different type of selector, by priority:
id > Class > tag > wildcard > inheritance > browser default
About wildcards: for example, CSS begins with a sentence * {margin:0;padding:0;} to match all tags.
(the wildcard selector is also directly selected)
(priority weight):
What is the weight of priority?
Function: when multiple selectors are mixed together, we can determine who has the highest priority by calculating the weight
Rules for calculating weights
First of all, calculate the number of id in the selector. The selector with more id has the highest priority.
If the number of id is the same, then if you look at the number of class names, those with more class names have the highest priority.
If the number of class names is the same, then look at the number of tag names. The number of tag names has the highest priority.
If the number of id is the same, the number of class names is the same, and the number of tag names is the same, then the calculation will not continue, so who writes later and listens to whom?
About! Important is used to increase the priority of a directly selected tag, written before the semicolon of the attribute value
At this point, the study on "what are the three characteristics of CSS" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.