这篇文章给大家介绍的内容是关于HTML5属性:margin属性的用法实例,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
p{
width: 100px;
height: 100px;
background-color: red;
/* 外边距 */
margin-top: 30px;
margin-left: 100px;
margin-right: 100px;
margin-bottom: 100px;
/* 连写 */
margin: 40px;
margin: 0 auto;
/* 内边距 pandding */
padding: 30px;
}
</style>
</head>
<body>
<p>p第一个</p>
<p>p第二个</p>
</body>
</html>运行效果如下:

相关推荐:
以上就是HTML5属性:margin属性的用法实例的详细内容,更多请关注php中文网其它相关文章!
HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号