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

Contains (descendant) selectors

Contains a selector, that is, adding spaces, which is used to select descendant elements under the specified label element. For example, the code in the code editor on the right:

.first span{color:red;}

This line of code will make the "cowardly" in the first paragraph of text "Rat" font color changes to red.

Please note the difference between this selector and a child selector. A child selector only refers to its direct descendants, or you can understand it as the first generation descendants that act on child elements. The descendant selector acts on all child descendant elements. Descendant selectors select with spaces, while child selectors select with ">".

Summary: > Acts on the first generation descendants of the element, and spaces act on all descendants of the element.


Continuing Learning
||
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>后代選擇器</title> <style type="text/css"> .first span{color:red;} .food>li{ border:1px solid red;/*添加邊框樣式(粗細(xì)為1px, 顏色為紅色的實線)*/ } </style> </head> <body> <p class="first">三年級時,我還是一個<span>膽小如鼠</span>的小女孩,上課從來不敢回答老師提出的問題,生怕回答錯了老師會批評我。就一直沒有這個勇氣來回答老師提出的問題。學(xué)校舉辦的活動我也沒勇氣參加。</p> <ul class="food"> <li>水果 <ul> <li>香蕉</li> <li>蘋果</li> <li>梨</li> </ul> </li> <li>蔬菜 <ul> <li>白菜</li> <li>油菜</li> <li>卷心菜</li> </ul> </li> </ul> </body> </html>
submitReset Code