关于如何利用CSS自动调整图片的大小

html-css018

关于如何利用CSS自动调整图片的大小,第1张

1、首先需要新建一个HTML页面。

2、然后输入页面的标题,可以按照下方图中的进行设置。

3、然后在根据下方图片中的代码进行编辑,

4、在两个div的class 中添加相同的控制图片的class名为了 ”img“,并为div添加控制宽度的样式。

5、在两个div中加入相同的图片<img src="images/5.png" />,在浏览器打开页面发现加入图片后把原来的div都给覆盖掉了。

6、然后在输入命令.img img{ width:100%height:auto},这样就完成了。

这是 图片慢慢放大和缩小

.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)}

}