CSS 参考手册
CSS #id Selector
为 id="firstname" 元素添加指定样式
源代码:
点击运行 »
<!DOCTYPE html> <html> <head> <style> #firstname { background-color: yellow; } </style> </head> <body> <h1>Welcome to My Homepage</h1> <div class="intro"> <p id="firstname">My name is Donald.</p> <p id="hometown">I live in Duckburg.</p> </div> <p>My best friend is Mickey.</p> </body> </html>
运行结果:
点击运行 »