首页
CSS
CSS 组合器
试用:子选择器
运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <style> div > p { background-color: yellow; } </style> </head> <body> <h2>Child Selector</h2> <p>The child selector (>) selects all elements that are the children of a specified element.</p> <div> <p>Paragraph 1 in the div.</p> <p>Paragraph 2 in the div.</p> <section> <!-- not Child but Descendant --> <p>Paragraph 3 in the div (inside a section element).</p> </section> <p>Paragraph 4 in the div.</p> </div> <p>Paragraph 5. Not in a div.</p> <p>Paragraph 6. Not in a div.</p> </body> </html>