亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

CSS3實(shí)現(xiàn)div從下往上滑入滑出效果示例

  發(fā)布時(shí)間:2020-04-28 16:24:43   作者:Amy o-O   我要評(píng)論
這篇文章主要介紹了CSS3實(shí)現(xiàn)div從下往上滑入滑出效果示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

1,首先需要用的是 CSS3的 target 選擇器,配合a標(biāo)簽指定id選擇器切換目標(biāo)元素,用于選取當(dāng)前活動(dòng)的目標(biāo)元素。
2,CSS3 的 transition 動(dòng)畫,這里不做詳細(xì)介紹

看一下效果圖:

點(diǎn)擊滑出按鈕,元素從底部勻速滑入到頁(yè)面一定高度;再點(diǎn)擊滑入,元素從當(dāng)前位置勻速滑入期初位置。


直接上代碼:

<h1>CSS3滑入/滑出效果</h1>
<div id="volet_clos">
    <div id="volet">
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima quisquam tempora quaerat dolores molestias reiciendis .</p>
        <p>vero labore voluptates necessitatibus ut? Et</p>
        <p>vero labore voluptates necessitatibus ut? Et</p>
        <p>vero labore voluptates necessitatibus ut? Et</p>
        <p>vero labore voluptates necessitatibus ut? Et</p>

        <a href="#volet"  aria-hidden="true" class="ouvrir">滑出</a>
        <a href="#volet_clos" aria-hidden="true" class="fermer">滑入</a>
    </div>
</div>
 <style>
        #volet_clos {position: fixed;top: 0px; left: 0;width: 100%;}
        #volet {width: 250px;padding: 10px;background: #6B9A49; color: #fff;width: 100%;}
        /* 初始定位 */
        #volet {position: absolute;left: 0px;top: 375px;transition: all .5s ease-in;}   
        #volet a.ouvrir,#volet a.fermer {position: absolute;right: -88px;top: 150px;}
        /* 點(diǎn)擊過(guò)后改變 target  */
        #volet a.fermer {display: none;}
        #volet:target {left: 0px;top: 150px;}
        #volet:target a.fermer {display: block;}
        #volet:target a.ouvrir {display: none;}
        #volet_clos:target #volet {left: 0px;top: 375px;}
        #volet a.ouvrir,#volet a.fermer{position: absolute;right: calc(40%);top: -40px;padding: 10px 25px; background: #555; color: #fff; text-decoration: none;text-align: center; width: 120px;}
    </style>

案例二,tab標(biāo)簽頁(yè)切換效果

 
 

 
 

<h1>tab標(biāo)簽頁(yè)切換效果</h1>
<div class="swiper-box">
    <div class="swiper-cont">
        <div class="swiper1" id="swiper1"></div>
        <div class="swiper2" id="swiper2"></div>
        <div class="swiper3" id="swiper3"></div>
    </div>
    <div class="swiper-num">
        <a href="#swiper1">1</a>
        <a href="#swiper2">2</a>
        <a href="#swiper3">3</a>
    </div>
</div>
/* tab標(biāo)簽頁(yè)切換效果 css */
.swiper-box{position: relative;width: 500px; height: 300px; margin: 20px auto; background: #f1f1f1;}
.swiper-cont div,.swiper1,.swiper2,.swiper3{ width: 0%; height: 300px;position: absolute;top: 0; left: 0;transition: width .5s linear;}
.swiper1{background: linear-gradient(to top, #fba555, #ffed6c 75%);}
.swiper2{background: linear-gradient(to left, #55d5fb, #fd74a7 75%);}
.swiper3{background: linear-gradient(to top left, #55fb69, #6cfff1  75%);}
.swiper-num{position: absolute; bottom: 0;right: 0;display: inline-block;z-index: 9;}
.swiper-num a{display: inline-block;margin-left: 10px;padding: 10px 20px; color: #333;font-size: 14px; text-decoration: none;font-weight: bold;background: rgba(255,255,255,.45);}
.swiper-num a:hover,.swiper-num a:active{ color: red;cursor: pointer;background: rgba(255,255,255,.95);}
.swiper-box :target{width: 100%;transition: width .5s linear;}

到此這篇關(guān)于CSS3實(shí)現(xiàn)div從下往上滑入滑出效果示例的文章就介紹到這了,更多相關(guān)CSS3實(shí)現(xiàn)div從下往上滑入滑出內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論