CSS inheritance

Some styles ofCSS

are inherited, so what is inheritance? Inheritance is a rule that allows styles to be applied not only to a specific html tag element, but also to its descendants. For example, the following code: If a certain color is applied to the p tag, this color setting applies not only to the p tag, but also to all sub-element text in the p tag, where the sub-element is the span tag.

p{color:red;} 

三年级时,我还是一个胆小如鼠的小女孩。

It can be seen that the text in p and the text in span in the result window on the right are set to red. But note that some CSS styles are not inherited. For example, border:1px solid red;

p{border:1px solid red;} 

三年级时,我还是一个胆小如鼠的小女孩。

In the above example, the function of the code is only to set the border to 1 pixel, red, and solid border line for the p tag, but it has no effect on the sub-element span. of.

    继承  

勇气

三年级时,我还是一个胆小如鼠的小女孩,上课从来不敢回答老师提出的问题,生怕回答错了老师会批评我。就一直没有这个勇气来回答老师提出的问题。学校举办的活动我也没勇气参加。

到了三年级下学期时,我们班上了一节公开课,老师提出了一个很简单的问题,班里很多同学都举手了,甚至成绩比我差很多的,也举手了,还说着:"我来,我来。"我环顾了四周,就我没有举手。

######
Continuing Learning
||
继承

勇气

三年级时,我还是一个胆小如鼠的小女孩,上课从来不敢回答老师提出的问题,生怕回答错了老师会批评我。就一直没有这个勇气来回答老师提出的问题。学校举办的活动我也没勇气参加。

到了三年级下学期时,我们班上了一节公开课,老师提出了一个很简单的问题,班里很多同学都举手了,甚至成绩比我差很多的,也举手了,还说着:"我来,我来。"我环顾了四周,就我没有举手。

submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!