<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
/* 将行内元素转换为块元素
display: block;
将块级元素转换为行级元素
display: inline;
将行内元素转换为块元素
display: inline-block; */
.ast {
width: 300px;
height: 50px;
background-color: green;
/* 将行内元素转换为块元素 */
display: block;
}
.divst {
/* 将块级元素转换为行级元素 */
display: inline;
}
.spanst {
width: 100px;
height: 300px;
background-color: skyblue;
/* 将行内元素转换为块元素 */
display: inline-block;
}
</style>
</head>
<body>
<a herf="#">块元素</a><br>
<a herf="#" clsss="ast">块元素转换为行内元素</a><br>
<div>我是块级元素</div><br>
<div class="divst">我是块级元素转换为行级元素</div><br>
<span>我是行内元素<span><br>
<span class="spanst">我是行内元素转换为块元素</span><br>
</body>
</html>
下载链接:
元素选择模式.html