HTML5中margin属性的使用案例

<!DOCTYPE html>

<html lang="en">

<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>

div{

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>

<div>div第一个</div>

<div>div第二个</div>

</body>

</html>

猜你喜欢

转载自blog.csdn.net/qq_26870933/article/details/81517142