源代碼
點擊運行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>教程</title> <style> .center { text-align: center; border: 3px solid green; } </style> </head> <body> <h2>文本居中對齊</h2> <div class="center"> <p>文本居中對齊。</p> </div> </body> </html>
運行結果