源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>编程字典</title> <style> body { margin: 0; padding: 0; } .right { float: right; width: 300px; background-color: #b0e0e6; } </style> </head> <body> <h2>右对齐</h2> <div class="right"> <p><b>注意: </b>使用浮动属性对齐时, 总是包含 !DOCTYPE 声明! 如果缺少,它会在IE浏览器中产生奇怪的结果.</p> </div> </body> </html>
运行结果