行块元素分类
.行级元素:(css的display:iline)
内容决所占位置,不可通过css改变行高
span/strong/em/a/del
块状元素:(css:block)
独占一行,可以通过css改变行高
p/div/ul/li/ol/from/address
行级块元素:(css:inline-block)
<img src=" ">
!!!!!!将其css属性给改了,也就不具有
本来原有的行/块属性)
以上属性及个别其他属性比如斜体加粗都可以用css的通配符消除,再自己建立。
操作:
html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" type="text/css" href="行级元素_字体_颜色.css"/>
</head>
<body>
<!-- 1. -->
<span>你好,明天</span>
<span class="demo">goodnight</span>
<!-- 2.颜色...... -->
<span class="taobao">天猫超市</span>
<div class="demo" id="id">你好呀</div>
</body>
</html>
css:
span{
background-color: aqua;
}
p.demo{
display: block;
background-color: beige;
}
span.taobao{
background-color:crimson ;
border-radius: 20px;
color : #fff;/*字体颜色 */
font-size: 20px; /* 字体大小 */
height: 30px;
font-weight: bold; /* 字体粗细 */
font-style: normal; /* 字体类型 */
}
*{
display:block;
width:100px;
font-style: normal;
}/*通配符使用*/
span{
background-color: aqua;
}
p.demo{
display: block;
background-color: beige;
}
span.taobao{
background-color:crimson ;
border-radius: 20px;
color : #fff;/*字体颜色 */
font-size: 20px; /* 字体大小 */
height: 30px;
font-weight: bold; /* 字体粗细 */
font-style: normal; /* 字体类型 */
}