What is the inheritance of css

清浅
Release: 2019-05-14 15:26:59
Original
6043 people have browsed it

Inheritance in CSS means that the tags contained inside will have the style of the external tags, that is, child elements can inherit the attributes of the parent element.

CSS has three major characteristics, namely inheritance, cascading, and priority. Next, I will introduce inheritance in CSS in detail in this article. I hope it will be helpful to you.

What is the inheritance of css

Inheritance:

Inheritance means that the tags wrapped inside will have the style of the outer tag, that is, the child Elements can inherit the attributes of the parent element. For example, in the following code, the div contains 2 p tags and 1 span tag. When the font color is set to red for the div, its child tags will inherit the attributes of the parent element and will therefore be displayed. red. In CSS, attributes starting with text-, font-, and line- can be inherited.

      

苹果

香蕉

葡萄
Copy after login

The displayed results are as follows:

What is the inheritance of css

The above is the detailed content of What is the inheritance of css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!