gpt4 book ai didi

html - 在 html/css 中缩放图像

转载 作者:太空宇宙 更新时间:2023-11-04 08:12:56 25 4
gpt4 key购买 nike

我有这样一张图片:

div.sliderimg {
height: 300px;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
transition: transform 5000ms linear 0s;
transform: scale(1.05, 1.05);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="sliderimg" style="background-image: url('http://images.unsplash.com/photo-1419064642531-e575728395f2?crop=entropy&fit=crop&fm=jpg&h=800&ixjsv=2.1.0&ixlib=rb-0.3.5&q=80&w=2400')">
<div class="carousel-caption">
<small>FEATURED ARTICLE</small>
</div>
</div>

但是它无法运行。可以请帮助我。

demo

最佳答案

我不确定转换是否发生在文档加载时。我会改用动画:

@keyframes example {
from {transform: scale(1, 1)}
to {transform: scale(1.05, 1.05)}
}

div.sliderimg {
animation-name:example;
animation-duration:5s;
animation-fill-mode: forwards;
}

关于html - 在 html/css 中缩放图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46130134/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com