CSS知识点笔记2----样式
1.高度和宽度
.c1{
height: 300px;
width: 500px;
}
- 宽度,支持百分比。
- 高度,不支持百分比
- 行内标签:默认无效
- 块级标签:默认有效
2.块级和行内标签
- 块级
- 行内
- css样式:标签->display:inline-blcok
3.字体和颜色
color:red;
font-size: 58px;
font-weight: 800;
font-family: Arial,Verdana,SansSerif;
4.文字的对齐方式
text-align: center;
line-height: 59px; #与元素行高保持一样
5.浮动
<span>左边</span>
<span style=”float:right”>右边</span>
div默认块级标签(霸道),如果浮动起来,就不一样了
如果让标签浮动起来,就会脱离文档流,得加<div style=”clear: both;”></div>
6.内边距