In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "what the CSS style proximity principle refers to". In the daily operation, I believe that many people have doubts about what the CSS style proximity principle refers to. The editor consulted all kinds of materials and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the doubts of "what the CSS style proximity principle refers to"! Next, please follow the editor to study!
In css, the nearest principle of style means that when many different style rules are applied to the same element, if the style weight is the same, the style close to the element has the highest priority; the nearest principle can also be understood as that when multiple styles have the same weight, the last style has the highest priority.
The operating environment of this tutorial: windows10 system, CSS3&&HTML5 version, Dell G3 computer.
What is the principle of proximity to CSS style
CSS priority
In complex CSS stylesheets, it is often not as simple as stacking the same style with different values, and there are often two or more different style rules applied to the same element. This is a typical CSS priority problem.
To deal with the priority problem is to consider the weight of the style. Here are some special situations:
= the weight of the inherited style is 0. That is, in a nested structure, regardless of the weight of the parent element style, when the child element inherits, the weight applied to the child element is 0, that is, the style defined by the child element overrides all inherited styles.
= = inline style takes precedence. The weight of the inline style of an element to which the style attribute is applied is so high that it can be understood as much greater than 100. In short, he has a higher priority than the above improved selector.
When the weights are the same, CSS follows the principle of proximity. That is to say, the style near the element has the highest priority, or the style at the end has the highest priority.
CSS defines a! important command, which is given the highest priority. In other words, regardless of the weight and the distance of the style location,! important has the highest priority.
Css weight
With regard to CSS weight, we need a set of formulas to calculate. This is CSS Specificity, which we call the CSS feature or extraordinary. It is a standard for measuring the priority of CSS values. The specific specifications are as follows:
Specificity is represented by a four-digit string of numbers (CSS2 is three digits), which is more like four levels, the value from left to right, the largest on the left, one level greater than one level, there is no binary between digits, and the levels cannot be surpassed.
At this point, the study of "what is the nearest principle of CSS style" 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.