HTML 中默认的
边距为 8px。它由浏览器提供的用户代理样式表以像素为单位定义。有些浏览器允许您创建和使用自己的用户代理样式表,但如果您正在开发网站,请保持不变。让我们看一个简单的例子。在这里,由于默认边距是 8px,我们不会尝试更改它 -
<!DOCTYPE html> <html> <title>Example</title> <head> <style> body { background: orange; } </style> <body> <h1>Free Resources</h1> <p>We have the following resources for the users:</p> <div id="container"> <ul> <li>Video Courses</li> <li>Notes</li> <li>Interview QA</li> <li>MCQs</li> </ul> </div> </body> </html>
现在,让我们更改默认边距 -
<!DOCTYPE html> <html> <title>Example</title> <head> <style> body { background: orange; margin: 25px; } </style> <body> <h1>Free Resources</h1> <p>We have the following resources for the users:</p> <div id="container"> <ul> <li>Video Courses</li> <li>Notes</li> <li>Interview QA</li> <li>MCQs</li> </ul> </div> </body> </html>
您可以轻松比较上述两个示例并发现边距差异。
以上就是默认边距有多宽?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号