.toShop-btn{
position: fixed
top:730rpx
width: 81rpx
height:91rpx
line-height: 48px
z-index:99
right:0rpx
-moz-animation: myfirst 1s infinite
-webkit-animation: myfirst 1s infinite
-o-animation: myfirst 1s infinite
animation: myfirst 1s infinite
}
@keyframes myfirst{
0% { transform: scale(.8)}
50% { transform: scale(1)}
100% { transform: scale(.8)}
}
最简单的 就是给你看下原理 你可以自己修改
<span style="font-size:16px" onclick="this.style.fontSize=(parseInt(this.style.fontSize.replace('px',''))+2)+'px'">单击放大文字</span>顺便说明parseInt是把字符串变数字 replace是把取得的css属性里的px去掉 原css里字体大小使用font-size控制 在js里对这种中间有横杠的都需要把横杠去掉并把第二个单词的首字母大写
这个效果要求是每个item元素的高度都是宽度的2倍,我们首先父元素box设置了宽度100%,这里我们主要利用padding的一个属性来解决问题,因为padding的宽度如果是百分数来计算的的话那么它的实际值都是相对父元素的宽度来算百分数的值,包括 padding-bottom 和 padding-top 也是如此,所以我们这里宽度可以设置为40%。由于我们这里box的宽度是100%,而高度没有告诉,所以不能直接设置高度值来取得效果,我可利用padding-bottom来代替height值,即如上所示,把height设为0,而把padding-bottom设为80%,这样我们就可以看到效果了,你可以随意拖放浏览器窗口大小,都是等比列缩小放大的哦这个也算是自适应屏幕的一个小方法吧》。。
html代码
代码如下
<div class="box"><div class="item"></div><div class="item"></div><div class="item"></div><div class="item"></div></div>
css代码
代码如下
.item { width:40%height:0padding-bottom: 80%background-color:#f00float:left margin:10px 5px}