以下为一个纯cs S写 的图片鼠标悬浮缩放效果,其实基本原理十分 简单 ,我们访问一些网站可以发现他们都会对图片做一些交互效果的处理,当然实现图片过渡效果有很多方式,例如使用 jq uery 或者 一些第三方js动画库,本例仅是展示基本的效果,不对所用知识进行 归纳 。
代码如下:
<!DOCTY PE ht ML >
<html lang="en">
<head>
< ;m eta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE= Edge ">
<meta n am e="viewport" content="width=device-width, in IT ial -s cale=1.0">
<title>Document</title>
<script></script>
<style>
* {
box-sizing: border-box;
}
body {
background-color: rgb(251, 163, 163);
}
/* 长条图样式 */
.cont ai nlist {
position: relative;
m arg in -t op: 100px;
mar gin -left:10%;
h ei ght: 100px;
width: 80%;
overflow: hidden;
border-radius: 30px;
box-shadow: rgb(54, 53, 53) 10px 10px 10px;
}
.list {
position: absolute;
width: 100%;
height: 100%;
background-position: center ;
background-size : cover;
border-radius: 30px;
transition: 0.5s;
color: white;
font-weight : bold;
text-align: center;
}
.list:hover {
transform: scale(1.2);
}
</style>
</head>
<body>
< h1 style="text-align: center;color: white;background-color: black;">效果测试</h1>
<!-- 长条图 -->
<div class="containlist">
<div class="list" style="background -i mage: url(006. jpg );">
和服の少女
</div>
</div>
<div class="containlist">
<div class="list" style="background-image: url(001.png);">
天空の鏡
</div>
</div>
<div class="containlist">
<div class="list" style="background-image: url(002.png);">
紫の景色
</div>
</div>
<div class="containlist">
<div class="list" style="background-image: url(003.png);">
私は一番可愛いです
</div>
</div>
</body>
</html>
实际效果 :
git图
图片的样式可以自行进行更改, 打造 你自己的中二风格。
到此这篇关于CSS3鼠标悬浮过渡缩放效果的 文章 就介绍到这了,更多相关css3鼠标悬浮过渡缩放内容请搜索以前的文章或继续浏览下面的相关文章,希望大家以后多多支持!
总结
以上是 为你收集整理的 CSS3鼠标悬浮过渡缩放效果 全部内容,希望文章能够帮你解决 CSS3鼠标悬浮过渡缩放效果 所遇到的问题。
如果觉得 网站内容还不错, 推荐好友。
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did201782