使用html css實現常見的網頁特效

效果預覽

在這裡插入圖片描述

1. 文字遮罩

在這裡插入圖片描述

html

<li class="big-grid havehover">
	<a href="">
		<div class="mask">
		</div>
		<div class="circle">
			<p>
				城市
			</p>
			<p>
				CityWalk
			</p>
		</div>
		<div class="word">
			【City Walk】大阪浪花の城——美食、動漫和不為人知的大阪人辛秘生活
		</div>
		<img src="images/yh.png" alt="">
	</a>
</li>

css

.common-part .center-wrap .content .big-grid{
    position: relative;
    width: 560px;
    height: 270px;
}
.common-part .content .havehover{
    overflow: hidden;
}
.common-part .content .havehover .mask{
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, .53);
    opacity: 0;
    transition: opacity .5s ease 0s;
}
.common-part .content .havehover .mask:hover{
    opacity: 1;
}
.common-part .content .havehover .circle{
    position: absolute;
    width: 106px;
    height: 106px;
    left: 50%;
    margin-left: -53px;
    top: -106px;
    font-size: 18px;
    text-align: center;
    box-sizing: border-box;
    padding-top: 25px;
    color: #FFFFFF;
    border: 1px solid #FFFFFF;
    border-radius: 50%;
    transition: top .5s ease 0s;
}
.common-part .content .havehover:hover .circle{
    top: 50px;
}
.common-part .content .havehover .word{
    position: absolute;
    width: 508px;
    height: 22px;
    font-size: 14px;
    color: #FFFFFF;
    line-height: 22px;
    text-align: center;
    bottom: -60px;
    transition: bottom .5s ease 0s;
}
.common-part .content .havehover:hover .word{
    bottom: 30px;
}

2. 圖片放大

在這裡插入圖片描述

html

<li class="pro-grid">
	<a href="">
		<div class="picbox">
			<img src="images/zsj2.png" alt="">
		</div>
		<div class="wordbox">
			北京/上海/南京/杭州直飛巴厘島5-7天往返含稅機票(贈送旅遊意外險…
		</div>
	</a>
</li>

css

.content-part .center-wrap .content>ul>li{
    float: left;
    width: 264px;
    height: 270px;
    margin-right: 32px;
    margin-bottom: 32px;
}
.content-part .center-wrap .content>ul>li .picbox{
    width: 264px;
    height: 184px;
    overflow: hidden;
}
.content-part .center-wrap .content>ul>li .wordbox{
    background: #FFFFFF;
    color: #1C1F21;
    font-size: 14px;
    line-height: 22px;
    padding: 22px 14px;
}
.content-part .center-wrap .content>ul>li .picbox img{
    transition: transform .5s ease 0s;
}
.content-part .center-wrap .content>ul>li .picbox img:hover{
    transform: scale(1.1);
}

3. 盒子陰影

在這裡插入圖片描述

html

<li class="pro-grid">
	<a href="">
		<div class="picbox">
			<img src="images/zsj2.png" alt="">
		</div>
		<div class="wordbox">
			北京/上海/南京/杭州直飛巴厘島5-7天往返含稅機票(贈送旅遊意外險…
		</div>
	</a>
</li>

css

.content-part .center-wrap .content>ul>li:hover{
    box-shadow: 0 8px 16px 0 rgba(0,0,0,0.20);
}

4. CSS動畫

在這裡插入圖片描述

html

<li class="more-grid">
    <a href="">
        <p>查看更多</p>
        <p>深度旅行產品</p>
        <span class="iconfont"></span>
        <ul>
            <li>日遊</li>
            <li>周末</li>
            <li>親子</li>
            <li>長線</li>
        </ul>
    </a>
</li>

css

@keyframes ud{
    from {
        transform: translateY(-10px);
    }
    to {
        transform: translateY(10px);
    }
}

.content-part .center-wrap .more-grid .iconfont{
    display: block;
    font-size: 48px;
    margin: 28px 0 36px 0;
}
.content-part .center-wrap .content .iconfont:hover{
    animation: ud .4s ease 0s infinite alternate;
}

5. 完整代碼

點擊前往代碼倉庫。

到此這篇關於使用html css實現常見的網頁特效的文章就介紹到這瞭,更多相關html 網頁特效內容請搜索WalkonNet以前的文章或繼續瀏覽下面的相關文章希望大傢以後多多支持WalkonNet!

推薦閱讀: