input去除黑色默认框
input {
outline:none;
}
css选中除了第一个(最后一个)剩下所有元素
ul li + li span{
color:red;
}
ul li:not(:first-child) span{
color:red
}
ul li:not(:last-child) span{
color:red
}
动画循环往返
.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);
}
}
创建一个4:3的矩形
<style>
* {
margin: 0;
padding: 0;
}
.wrap {
width: 400px;
margin: 100px auto;
}
.box {
width: 100%;
/* 设置height为0 ,避免盒子被内容撑开多余的高度 */
height: 0px;
/* 利用padding-bottom把盒子的高撑开,
padding-top padding-bottom margin-top margin-bottom 百分比相对的是!!父元素盒子的宽度!! */
padding-bottom: 75%;
background: pink;
color: #666;
}
</style>
<body>
<div class="wrap">
<div class="box">
<p> 这是一个自适应的正方形</p>
</div>
</div>
</body>