CSS-塊級與行內轉換
阿新 • • 發佈:2019-02-14
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>display</title>
<style>
div{
width: 100px;
height: 100px;
background-color: red;
/*display: inline;*/
display: inline-block;
}
span{
width: 100px;
height: 100px;
background-color: blue;
display: block;
}
</style>
</head>
<body>
<div>hello |</div>
<div>world</div>
<span>hello</span>
<span>world</span>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>display</title>
<style>
div{
width: 100px;
height: 100px;
background-color: red;
/*display: inline;*/
display: inline-block;
}
span{
width: 100px;
height: 100px;
background-color: blue;
display: block;
}
</style>
</head>
<body>
<div>hello |</div>
<div>world</div>
<span>hello</span>
<span>world</span>
</body>
</html>