源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>编程字典</title> <style> p.center { text-align: center; color: red; } </style> </head> <body> <h1 class="center">这个标题不受影响</h1> <p class="center">这个段落红色居中显示</p> </body> </html>
运行结果