亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

CSS inheritance

Some styles of CSS

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;}

<p>三年級(jí)時(shí),我還是一個(gè)<span>膽小如鼠</span>的小女孩。</p>

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;}

<p>三年級(jí)時(shí),我還是一個(gè)<span>膽小如鼠</span>的小女孩。</p>

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.

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>繼承</title>
<style type="text/css">
p{color:red;}
span{border:1px solid blue;
    color:#aa2355;}
p{border:1px solid red;}
</style>
</head>
<body>
    <h1>勇氣</h1>
    <p class="first">三年級(jí)時(shí),我還是一個(gè)<span>膽小如鼠</span>的小女孩,上課從來(lái)不敢回答老師提出的問(wèn)題,生怕回答錯(cuò)了老師會(huì)批評(píng)我。就一直沒(méi)有這個(gè)勇氣來(lái)回答老師提出的問(wèn)題。學(xué)校舉辦的活動(dòng)我也沒(méi)勇氣參加。</p>
    <p id="second">到了三年級(jí)下學(xué)期時(shí),我們班上了一節(jié)公開課,老師提出了一個(gè)很<span>簡(jiǎn)單</span>的問(wèn)題,班里很多同學(xué)都舉手了,甚至成績(jī)比我差很多的,也舉手了,還說(shuō)著:"我來(lái),我來(lái)。"我環(huán)顧了四周,就我沒(méi)有舉手。</p>
</body>
</html>

######
Continuing Learning
||
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>繼承</title> <style type="text/css"> p{color:red;} span{border:1px solid blue; color:#aa2355;} p{border:1px solid red;} </style> </head> <body> <h1>勇氣</h1> <p class="first">三年級(jí)時(shí),我還是一個(gè)<span>膽小如鼠</span>的小女孩,上課從來(lái)不敢回答老師提出的問(wèn)題,生怕回答錯(cuò)了老師會(huì)批評(píng)我。就一直沒(méi)有這個(gè)勇氣來(lái)回答老師提出的問(wèn)題。學(xué)校舉辦的活動(dòng)我也沒(méi)勇氣參加。</p> <p id="second">到了三年級(jí)下學(xué)期時(shí),我們班上了一節(jié)公開課,老師提出了一個(gè)很<span>簡(jiǎn)單</span>的問(wèn)題,班里很多同學(xué)都舉手了,甚至成績(jī)比我差很多的,也舉手了,還說(shuō)著:"我來(lái),我來(lái)。"我環(huán)顧了四周,就我沒(méi)有舉手。</p> </body> </html>
submitReset Code