- hover动画
.hover-ani { display: inline-block; position: relative; color: #33151e; } .hover-ani::after { content: ''; position: absolute; width: 100%; transform: scaleX(0); height: 2px; bottom: 0; left: 0; background-color: #33151e; transform-origin: bottom right; transition: transform 0.25s ease-out; } .hover-ani:hover::after { transform: scaleX(1); transform-origin: bottom left; } <div class="hover-ani">移动到内容出现动画</div>
- 竖线
.shortcut{ display: flex; } li { list-style-type: none; margin: 0; padding: 0 0.75rem; } li:not(:last-child) { border-right: 1px solid #d2d5e4; } <ul class="shortcut"> <li>首页</li> <li>关于</li> <li>联系</li> </ul>
- 小三角 bottom向上 top向下 第二个left向右 right向左
.triangle { width: 0; height: 0; border-top: 10px solid #333; border-left: 10px solid transparent; border-right: 10px solid transparent; } .triangle { width: 0; height: 0; border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-left: 10px solid #333; } <div class="triangle"></div>
- 文本截断
.ell-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; width: 200px; } <div class="ell-text">测试文本截断显示三个点测试文本截断显示三个点.</div>
- loading
@keyframes donut-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .loading { display: inline-block; border: 3px solid rgba(0, 0, 0, 0.2); border-left-color: #333; border-radius: 50%; width: 25px; height: 25px; animation: donut-spin 1s linear infinite; } <div class="loading"></div>
- 美化表格
.table {width:90%;background:#ddd; margin: 10px auto;border-collapse:collapse;} .table th, .table td {height:25px;line-height:25px;text-align:center;border:1px solid #ddd;} .table th {background:#eee;font-weight:normal;} .table tr {background:#fff;} .table tr:hover {background: #d6f8dc;} .table td a {color:#06f;text-decoration:none;} .table td a:hover {color:#06f;text-decoration:underline;}
- 1px水平线
.hr1 { width:100%; margin:0 auto; border: 0; height:0; border-top: 1px solid rgba(0, 0, 0, 0.1); }
- 自定义选择色
.selection::selection { background: deeppink; color: white; }
- a属性
a[disable]{ opacity:0.5; cursor:default; pointer-events:none}
- 横向垂直居中
.v-center{ display:flex;align-items: center;justify-content:center; }
- 必填
.req:after{ content: ' *'; color: #EF4F4F; font-weight:bold; }
- css loading动画,有遮罩层
.loading2{color:#fff;position:fixed;box-sizing:border-box;left:-9999px;top:-9999px;width:0;height:0;overflow:hidden;z-index:999999}.loading2:after,.loading2:before{box-sizing:border-box}.loading2{background-color:rgba(0,0,0,0.7);width:100%;height:100%;left:0;top:0}@keyframes rotation{from{transform:rotate(0)}to{transform:rotate(359deg)}}@keyframes blink{from{opacity:.5}to{opacity:1}}.loading2[data-text]:before{position:fixed;left:0;top:50%;color:currentColor;font-family:Helvetica,Arial,sans-serif;text-align:center;width:100%;font-size:16px}.loading2[data-text='']:before{content:'Loading...'}.loading2:not([data-text='']):before{content:attr(data-text)}.loading2[data-text]:before{top:calc(50% - 63px)}.loading2:after{content:'';position:fixed;width:48px;height:48px;border:solid 4px #fff;border-left-color:transparent;border-radius:50%;top:calc(50% - 24px);left:calc(50% - 24px);animation:rotation 1s linear infinite}
<div class="loading2" data-text="加载中..."></div>
$('.loading').show();
$('.loading').hide();
- 无遮罩层
.loading1{display:block;position:absolute;top:50%;left:50%;height:48px;width:48px;margin:-24px 0 0 -24px;border:4px rgba(0,0,0,0.25) solid;border-top:4px black solid;border-radius:50%;-webkit-animation:spin2 .6s infinite linear;animation:spin2 1s infinite linear}@-webkit-keyframes spin2{from{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(359deg)}}@keyframes spin2{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}
- gif动画
.loading3{ width:32px;height:32px; background-image: url("data:image/gif;base64,R0lGODlhIAAgAPMAAP///3GaEN7nybrNi9bhusbWoI6vQqC7YOjv2u/z5dnkwIGlLHObEwAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAIAAgAAAE5xDISWlhperN52JLhSSdRgwVo1ICQZRUsiwHpTJT4iowNS8vyW2icCF6k8HMMBk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