CSS核心属性

文本
font-family字体类型  字体是中文时,加双引号。英文字体有空格时,加双引号。英文字体写在中文前(英文字体不会影响中文,中文会影响英文)
font-size 文本大小  默认1em=16px
color
font-weight 加粗位重 bolder/bold/normal(100-500(常规)-900(粗))
font-style:字体倾斜 italic/oblique(幅度大,一半区分不明显)/normal
text-align水平对齐  left/right/center/justify(以两端边界线对齐显示)
line-height 行高
text-decoration 线
text-indent:24px  首行缩进

列表
<ul><li></li></ul>无序列表  list-style-type  disc(实心圆)/circle(空心圆)/square(实心方块)/none
list-style-position:inside  把图标包进<li>里面
list-style:none 符号去除

背景
background-color
background-repeat平铺  no-repeat/repeat/repeat-x/repeat-y
background-position背景图片位置(负值左上,正值右下)
{background-position:值1  值2;}值1水平方向上对齐方式(left/center/right)值2垂直方向上对齐方式(top/center/bottom)
缩写
{background:属性1,2,3}#背景色  url(背景图片的路径及全程) no-repeat  center top

浮动属性
float
{float:left/right/none}
clear:规定元素哪一侧不允许其他浮动元素
(
none:允许浮动元素出现在两侧
both:在左右两侧不允许浮动元素
left right

解决高度塌陷
1.overflow:hidden
2.在浮动元素下方添加空的div,给该元素声明clear:both;height:0;overflow:hidden(或font-size:0;)

猜你喜欢

转载自blog.csdn.net/qq_35254240/article/details/88941165