常用CSS的布局问题;
阅读原文时间:2023年07月08日阅读:1
//当文字长度超过50px会已省略好的方式显示;  

   width:50px;
   overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;

//怎么用最简单的方法加上 * 号呢?利用伪元素

label:before{
content: "*";
display: inline-block;
margin-right: 4px;
line-height: 1;
font-size: 12px;
color: red;
}

方法一:通过定位移动

.父元素 {
position: relative;
height: 300px;
}
.子元素 {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}