In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you the example analysis of inheritance in CSS, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
1. Explanation-TOP
Here DIV CSS inheritance means that we set the CSS style of the parent (parent), and the parent (parent) and the following children (subordinate) have this property.
Generally, only text has inheritance characteristics, such as text size, text bold, text color, font and so on.
2. Example:-TOP CSS inheritance feature-www..com .yangshi {width:400px; color:#F00;} .ziji {float:left; width:300px;} I am a child and my superior is yangshi
Description: I set the text color of the parent (parent: yangshi) to red, while the child (ziji) does not set the text color, but the text has inheritance properties, so the child text content is still red.
If you set the parent text style, some of its children may not want to have the same color as the parent, so you only need to set the color for the corresponding children.
The demonstration is as follows:
DIV CSS inheritance feature-www..com
.yangshi {width:400px; color:#F00;}
.ziji {width:300px;}
.ziji2 {width:300px; color:#000;}
I am a child, and my superior is yangshi.
I am child 2, and I set the text color to black
Description: there are two children under yangshi: ziji and ziji2, in which ziji inherits the parent (superior red style), while ziji2 we need black, so set the text to black style for ziji2 alone.
3. Inheritance benefits-TOP
You can only set the CSS stylesheet properties of the superior, but not the children (subordinates). They all have this CSS attribute, which can reduce the CSS code and make it easy to maintain.
4. Common inheritance CSS attribute-TOP
1. Font: font-family
2. Text size: css font-size
3. Text thickness: font-weight
4. Text color: css color
Usually only the text CSS font has the inheritance feature, so we make good use of it and understand it.
The above is all the content of the article "sample Analysis inherited in CSS". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.