前言

大家好,写了那么久文章,也没写关于css的知识点。写前端的都知道css是前端非常重要。css学好,一定会得到大家的刮目相待。废话不多说,直接来学习吧!

一、常用样式

1、文本样式

  1. 颜色:color:red|#fff|rgb(255,0,0)
  2. 大小:font-size:12px|1em|1rem
  3. 字重:font-weight:light|bold|900
  4. 风格:font-style:italic 倾斜 | normal 正常
  5. 字体:font-family
  6. 下划线:text-decoration:none|underline
  7. 行高:line-height:16px
  8. ul\ol样式:list-style:none
  9. 文本水平对齐:text-alight:left|center|right
  10. 缩进:text-indent:16px|1em|1rem

2、布局样式

1、元素状态:display:none|flex|inline-block
2、宽度:width:1px
3、高度:height:2px
4、背景:backgroud-color: red
backgroud-position: -20 -40 图片读图【可以百度下,很强大】
5、边框:border 1px solid实线|dashed虚线 颜色
6、外边距:margin
7、内边距:padding
8、定位:

position: static静态|relative相对定位|absolute绝对定位|fixed固定定位
	坐标
    	top 上移动距离 right left bottom
        z-index	层叠

9、浮动:

float: left左|right右
清除浮动影响
overflow:hidden
clear:left|right|both
height: 设置父级盒子固定高度