Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>本教程(w3big.com)</title> <style> p:only-child { background:#ff0000; } </style> </head> <body> <div><p>This is a paragraph.</p></div> <div><span>This is a span.</span><p>This is a paragraph.</p></div> <p><b>注意:</b> Internet Explorer 8以及更早版本的浏览器不支持 :only-child选择器.</p> </body> </html>