CSS selector child element

All selectors Reference Manual: http: //www.w3school.com.cn/cssref/css_selectors.asp

1) the sub-element selector

Reference link: http: //www.w3school.com.cn/cssref/selector_nth-child.asp

p:nth-child(2)
{
background:#ff0000;
}
选择所有的p元素 的 父元素 的 第二个子元素,不论类型

  

2) sub-element selector with type

p:nth-of-type(2)#选择元素p 的 父元素 的 第二个子元素,不论类型
{ background:#ff0000; }

 

3) can be selected such

header #search input[type="text"] {

  

Reproduced in: https: //www.cnblogs.com/Gaoqiking/p/11029055.html

Guess you like

Origin blog.csdn.net/weixin_34406061/article/details/93256750