块元素
行元素,独占一行
加个颜色,看看块元素的效果
<style>
.box {
background-color:green
}
</style>
</head>
<body>
<div class="box">hello </div>
<p>whord</p>
<div class="box">I am no happy</div>
</body>
行内元素
<style>
.box {width:250px;
background-color:yellow
}
</style>
</head>
<body>
<div class="box">
<a href="#">链接???</a>
<a href="#">链接???</a>
<a href="#">链接???</a>
</div>
</body>
display:inline-block
<style>
.box {width:500px;
height:300px;
border:1px solid #000;
margin:50px auto 0;
}
.box a {
background-color:gold;
width:100px;
height:50px;
padding:0 10px;
display:inline-block;
}
</style>
</head>
<body>
<div class="box">
<a href="#">链接???</a>
<a href="#">链接???</a>
<a href="#">链接???</a>
<a href="#">链接???</a>
<a href="#">链接???</a>
</div>
</body>
display属性