Css常用样式
Width:30px;宽度
Height:30px;高度
line-height: 30px;行高
padding: 30px;内边距 padding-top padding-left
margin: 30px;外边距 margin-top
margin: auto;(一般跟在宽度后边设置左右居中)
float: left;左浮动 应用于子元素,自身
float: right;右浮动
display: block; 使行内元素成为块级元素,占用一行 列如span标签
display: inline; 在同一行,并且宽度就等于文字内容的宽度且设置宽度无用
display: inline-block; 既有行级元素的特性,也有块级元素的特性,因此在同一行,能设置宽高
display: flex;弹性布局(使子元素水平方向应用于一行,作用等同于float:left)应用于父元素
flex-wrap: wrap;让弹性盒子必要的时候换行,超出宽度自动换行
justify-content: space-between;一般跟display:play一起应用,
即让子元素左右对齐,在父元素上添加
justify-content: space-around;居中对齐,就是两边都留有空白
justify-content: flex-start;从项目开头对齐
justify-content: flex-end;从项目结尾对齐
justify-content: center;左右对齐
align-items: center;上下对齐 跟上边的center一般用于移动端块级元素上下左右对齐
box-shadow: 0px 0px 0px red;阴影,投影
text-align: center;文字水平方向居中对齐
letter-spacing: 2px;字符间距,即字符左右间的间距
text-indent: 2em;首行缩进,多用块级元素
list-style: none;多用于去除ul li的默认样式
border-radius: 4px;设置块级元素圆角
cursor: pointer;出现小手图标,其他图标样式自行百度
overflow: hidden; 超出隐藏
text-overflow: ellipsis;禁止自动换行
white-space: nowrap;以上三行为文字超出部分用。。。展示
text-decoration: underline;下划线
text-decoration: overline;上划线
Width:30px!important;!important为最高级
overflow-y: hidden;水平超出隐藏
overflow-y: scroll;出现滚动区域
position: relative;相对定位
position: absolute;绝对定位
position: fixed;固定定位
background: url();引入背景图片
background-repeat: no-repeat; 不重复显示
background-size: 100% 100%;图片大小
background: rgba(255,239,39,0.22);设置透明度;可百度搜索rgba转换器吧正常颜色转为rgba 最后0.22位透明度
background: linear-gradient(90deg, #fdde4f, #fdb94f);颜色渐变
vertical-align: middle;垂直居中对齐,多用于图片垂直对齐
z-index: 1;层次高低