動畫循環往返
.icon_delivery_man {
position: absolute;
top: 130px;
left: 20px;
display: inline-block;
width: 42px;
height: 41px;
background: url("../images/lj/icon-electrombile2.png") no-repeat center / 42px 41px;
transform:rotateX(0) rotateY(-180deg) translate(21px, -20px);
-webkit-animation: deliveryMan 30s linear 0s infinite normal;
animation: deliveryMan 30s linear 0s infinite normal;
/* animation:動畫名 動畫時長 動畫速度(linear勻速) 開始前延遲 循環播放 是否輪流反向播放; */
}
@keyframes deliveryMan {
0% {
top: 130px;
left: 20px;
}
6% {
left: 97px;
top: 191px;
}
14% {
left: 200px;
top: 40px;
}
25% {
left: 465px;
top: 43px;
}
28% {
left: 465px;
top: 67px;
}
30% {
left: 491px;
top: 86px;
}
42% {
left: 520px;
top: 314px;
}
50% {
left: 642px;
top: 338px;
transform: rotateX(0) rotateY(-180deg) translate(21px, -20px);
}
51%{
left: 642px;
top: 338px;
transform: rotateX(0) rotateY(0deg) translate(-26px, -20px);
}
60%{
left: 520px;
top: 314px;
}
72%{
left: 491px;
top: 86px;
}
75%{
left: 455px;
top: 67px;
}
78%{
left: 455px;
top: 43px;
}
88% {
left: 200px;
top: 40px;
}
96% {
left: 60px;
top: 191px;
}
100% {
top: 130px;
left: 20px;
transform: rotateX(0) rotateY(0deg) translate(21px, -20px);
}
}
阻止被點擊
div{
pointer-events: none;
}
橫向超出顯示滾動條,注意給文字加不換行樣式
div{
width:200px;
height:200px;
overflow-x:auto;
}
.div-son{
white-space:nowrap;
}
flex下自適應超出顯示省略號
添加鏈接描述
<div id="wrap">
[外鏈圖片轉存失敗(img-0H01jPF6-1562220251071)(https://mp.csdn.net/mdeditor/img1.jpg)]
<div id="right">
<p class="name">暱稱</p>
<p class="content">內容顯示省略號內容顯示省略號內容顯示省略號內容顯示省略號內容顯示省略號內容顯示省略號內容顯示省略號內容顯示顯示省略號內容顯示省略號內容顯示省略號</p>
</div>
</div>
#wrap {
display: flex;
border: 1px solid black;
}
#left {
width: 100px;
height: 100px;
margin: 10px;
border: 1px solid #ccc;
}
#right {
flex: 1;
background: yellow;
}
.content {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
background: red;
}
顯然,由於.content設置了white-space: nowrap;,因此內容就將父元素#right撐開,溢出了#wrap。停一下,想一想既然溢出是因爲#right被撐開了,那給#right(即.content的父元素)設置overflow:hidden就可以防止.content將#right撐開,應該就能達到效果。
還可以給#right設置width:0(或者一個較小的寬度),也可以達到同樣是效果;
IOS,去除input框頂部的內陰影
appearance:none;
-webkit-appearance:none;
-moz-appearance:none;
縮放反彈效果,類似有慣性的樣子
@keyframes bounceIn {
/* from, 20%, 40%, 60%, 80%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
} */
0% {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
20% {
-webkit-transform: scale3d(1.1, 1.1, 1.1);
transform: scale3d(1.1, 1.1, 1.1);
}
40% {
-webkit-transform: scale3d(.9, .9, .9);
transform: scale3d(.9, .9, .9);
}
60% {
opacity: 1;
-webkit-transform: scale3d(1.03, 1.03, 1.03);
transform: scale3d(1.03, 1.03, 1.03);
}
80% {
-webkit-transform: scale3d(.97, .97, .97);
transform: scale3d(.97, .97, .97);
}
to {
opacity: 1;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}