1. 让文字一行显示
/* 让文字一行显示 */
word-break: keep-all;
white-space: nowrap;
2. 字体让它小于12px;
/* 字体让它小于12px */
transform: scale(0.8);
3.首行空两格
p{
text-indent: 2em;//首行空两格
}
4.文字超出不换行,多的用点代替(三者不能缺少)
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
5.文字两端对齐
text-align:justify;
6.水平垂直居中
display: flex;
justify-content: center; /* 水平居中 */
align-items: center; /* 垂直居中 */
7.flex布局注意点
8.使用伪类去除button边框(当outline和border都没有效果时)
.container .codeBtn::after{
border: none;
}
9.flex上下左右垂直居中
display: flex;
justify-content: center; /* 水平居中 */
align-items: center; /* 垂直居中,记住呀副轴是align-items */
10.设置文字间距
letter-spacing:2px
11.antd里的顽固按钮去除默认样式方法
.btn{
background-color: #0ac986 !important;
border: none;
outline: none;
color: #fff;
}
.btn:hover{
background-color: #0ac986 !important;
border: none;
outline: none;
color: #fff;
}
.btn:focus{
background-color: #0ac986 !important;
border: none;
outline: none;
color: #fff;
}
12.定位居中办法
width: 600px;
height: 400px;
position: absolute;
left: 50%;
top: 50%;
margin-top: -200px; /* 高度的一半 */
margin-left: -300px; /* 宽度的一半 */
13.隐藏滚动条
.element::-webkit-scrollbar {display:none}
14.sticky滚动粘性定位,跟top值后变为固定定位(下面代码表示滚动到top:0后变成固定定位)
position: sticky;
top: 0px;
15.简单添加异步的方法
比如:如果让some变成同步后再执行操作那可以写成下面这个.