您好,登錄后才能下訂單哦!
本篇內(nèi)容主要講解“怎么用CSS3實(shí)現(xiàn)百葉窗式鼠標(biāo)滑過hover圖片動(dòng)畫效果”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“怎么用CSS3實(shí)現(xiàn)百葉窗式鼠標(biāo)滑過hover圖片動(dòng)畫效果”吧!
準(zhǔn)備
示例基于bootstrap3,所以在頁面中引入bootstrap和font-awesome字體圖標(biāo)文件。
<link rel="stylesheet" href="path/to/bootstrap.min.css"><link rel="stylesheet" href="path/to/font-awesome.min.css">
該CSS3百葉窗式鼠標(biāo)hover圖片動(dòng)畫效果的HTML結(jié)構(gòu)如下:
<p class="container> <p class="row> <p class="col-md-4 col-sm-6> <p class="box> <img src="images/img-1.jpg> <p class="box-content> <p class="inner-content> <h4 class="title>Williamson</h4> <span class="post>Web Developer</span> </p> <ul class="icon> <li><a href="#><i class="fa fa-search></i></a></li> <li><a href="#><i class="fa fa-link></i></a></li> </ul> </p> </p> </p> <p class="col-md-4 col-sm-6> <p class="box> <img src="images/img-2.jpg> <p class="box-content> <p class="inner-content> <h4 class="title>Kristiana</h4> <span class="post>Web Designer</span> </p> <ul class="icon> <li><a href="#><i class="fa fa-search></i></a></li> <li><a href="#><i class="fa fa-link></i></a></li> </ul> </p> </p> </p> </p></p>
然后通過下面的CSS代碼來實(shí)現(xiàn)百葉窗式鼠標(biāo)hover圖片動(dòng)畫效果,直接上代碼。
.box{ text-align: center; overflow: hidden; position: relative;}.box img{ width: 100%; height: auto; transform: scale(1.6); transition: all 0.3s ease 0s;}.box:hover img{ filter: grayscale(100%); transform: scale(1.2);}.box .box-content{ width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 2; transition: all 0.2s ease 0s;}.box:before,.box:after,.box .box-content:before,.box .box-content:after{ content: ""; width: 100%; height: 25%; background: linear-gradient(to right,rgba(0,0,0,0.9),rgba(0,0,0,0.7),transparent,rgba(0,0,0,0.7),rgba(0,0,0,0.9)); z-index: 1; position: absolute; top: 0; left: 0; transition: all 0.3s ease 0s;}.box:before{ transform: translateX(100%); }.box:after{ height: 25.1%; top: 25%; transform: translateX(-100%); transition-delay: 0.05s;}.box .box-content:before{ top: 50%; transform: translateX(100%); transition-delay: 0.1s;}.box .box-content:after{ top: 75%; transform: translateX(-100%); transition-delay: 0.15s;}.box:hover:before,.box:hover:after,.box:hover .box-content:before,.box:hover .box-content:after{ transform: translateX(0); }.box .inner-content{ padding: 7px 0; text-align: right; position: absolute; bottom: 10px; right: 20px; z-index: 2; transition: all 0.3s ease 0s;}.box .title{ font-size: 22px; font-weight: 700; color: #faac01; letter-spacing: 1px; text-transform: uppercase; margin: 0 0 3px 0; opacity: 0; transform: translateY(150px); transition: all 0.4s ease 0s;}.box .post{ display: inline-block; padding: 0 5px; font-size: 16px; font-style: italic; color: #fff; opacity: 0; transform: translateY(50px); transition: all 0.4s ease 0s;}.box:hover .title,.box:hover .post{ opacity: 1; transform: translate(0, 0);}.box .icon{ padding: 0; margin: 0; list-style: none; position: absolute; top: -200px; left: 10px; z-index: 2; transition: all 0.4s ease 0.2s;}.box:hover .icon{ top: 15px; }.box .icon li a{ display: block; width: 40px; height: 40px; line-height: 40px; background: #faac01; font-size: 20px; color: #fff; margin-bottom: 10px; position: relative; transition: all 0.3s ease 0s;}.box .icon li a:hover{ text-decoration: none; border-radius: 30%; background: #fff; color: #faac01;}@media only screen and (max-width:990px){ .box{ margin-bottom: 30px; }}@media only screen and (max-width:479px){ .box .title{ font-size: 18px }}
到此,相信大家對(duì)“怎么用CSS3實(shí)現(xiàn)百葉窗式鼠標(biāo)滑過hover圖片動(dòng)畫效果”有了更深的了解,不妨來實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。