常用css效果[持续更新...]

257 阅读1分钟

1,分隔线

.ivider-line{
    height: 1px;
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0);
}

2,指定宽高的居中弹窗

.center-modal{
    box-sizing: border-box;
    text-align: center;
    padding: 1em;
    line-height: 300%;
    top: 30%;
    right: 30%;
    background: #eee;
    border: solid 1px;
    border-color: #bbb;
    box-shadow: 0 0 8px gold;
    height: 40%;
    width: 40%;
    border-radius: 4px;
    transition: all 0.5s ease;
}

3,三角形和三角线

.css-triangle-left{
  position: relative;
  height: 0px;
  width: 0px;
  border-top: 90px solid transparent;
  border-right: 100px solid black;
  border-bottom: 100px solid transparent;
}
.css-triangle-left:after{
  content: '';
  position: absolute;
  top: -89px;
  left: 2px;
  border-top: 89px solid transparent;
  border-right: 99px solid #FFFFFF;
  border-bottom: 99px solid transparent;
}

.triangle{
    width: 0;
    height: 0;
    border-width: 40px;
    border-style: solid;
    border-color: red transparent transparent transparent;
}

4,实现角标

.subgrid-table-two .item-status-parent{
    position: relative;
    overflow: hidden;
}
.subgrid-table-two .item-status{
    position: absolute;
    top: -50px;
    right: 0;
    font-weight: 400;
    height: 0;
    width: 0;
    border-top: 50px solid transparent;
    border-bottom: 50px solid transparent;
}
.item-status{
    display: none;
    border-right: 60px solid #419cd0;
}
.item-status-applying,.item-status-handeling,.item-status-done{
    display: unset;
}
.item-status-applying{
    border-right-color: #ffa254 ;
}
.item-status-handeling{
    border-right-color: #09c798;
}
.item-status-done{
    border-right-color: #4b98ed;
}

5,设置图片等比例自适应且不超出

.imgAuto{
    width: auto;
    max-height: 50px;
    max-width: 100%;
}

6, 滚动包裹盒子的底部边框不被子标签覆盖掉

.add-invoice-main{
    border-bottom: 0 none;
    position: relative;
}
.add-invoice-main::after{
    content:'';
    position:absolute;
    width: 100%;
    bottom: 0;
    left: 0;
    border-top: 1px solid #d3d3d3;
    z-index: 9;
}