CSS
CSS Id 和 Class
在以下实例中, 所有的 p 元素使用 class="center" 让该元素的文本居中
源代码:
点击运行 »
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> p.center { text-align: center; } </style> </head> <body> <h1 class="center">这个标题不受影响</h1> <p class="center">这个段落居中对齐。</p> </body> </html>
运行结果:
点击运行 »