1.margin-top 属性设置元素的上外边距。
注意:允许使用负值。
2.html 文件
<html> <head> <style type="text/css"> p.topmargin {margin-top: 5cm} </style> </head> <body> <p>这个段落没有指定外边距。</p> <p class="topmargin">这个段落带有指定的上外边距。</p> </body> </html>
3.效果图

本文介绍了 CSS 中 margin-top 属性的基本用法及其注意事项,并通过一个 HTML 示例展示了如何为段落元素设置上外边距。
1.margin-top 属性设置元素的上外边距。
注意:允许使用负值。
2.html 文件
<html> <head> <style type="text/css"> p.topmargin {margin-top: 5cm} </style> </head> <body> <p>这个段落没有指定外边距。</p> <p class="topmargin">这个段落带有指定的上外边距。</p> </body> </html>
3.效果图

872
492

被折叠的 条评论
为什么被折叠?