inline-block(内联块):
先有如下代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
div,span{
width:200px;
height:200px;
background:red;
}
</style>
</head>
<div>div1</div>
<div>div2</div>
<hr/>
<span>span1</span>
<span>span2</span>
<body>
</body>
</html>
此时页面效果:
之后我们加上display:inline-block;
页面变成了这样:
display:inline-block:既支持了宽高,又能在同一行中非常融洽的显示