源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>编程字典</title> <style> h1 { text-align: center; } h2 { text-align: left; } h3 { text-align: right; } </style> </head> <body> <h1>标题 1 (居中)</h1> <h2>标题 2 (左)</h2> <h3>标题 3 (右)</h3> <p>这个三个元素的对齐方式分别是:居中、左对齐和右对齐.</p> </body> </html>
运行结果