效果鼠標觸碰按鈕,出現(xiàn)水墨風格動畫屏幕自適應一份html文件,一份css文件,無javascript,上手程度:很簡單筆記:root這個 CSS 偽類匹配文檔樹的根元素。對于 HTML 來說,:root 表" />

国产成人精品无码青草_亚洲国产美女精品久久久久∴_欧美人与鲁交大毛片免费_国产果冻豆传媒麻婆精东

15158846557 在線咨詢 在線咨詢
15158846557 在線咨詢
所在位置: 首頁 > 營銷資訊 > 網(wǎng)站運營 > web前端入門到實戰(zhàn):html5網(wǎng)頁特效-水墨動畫

web前端入門到實戰(zhàn):html5網(wǎng)頁特效-水墨動畫

時間:2023-07-24 21:51:01 | 來源:網(wǎng)站運營

時間:2023-07-24 21:51:01 來源:網(wǎng)站運營

web前端入門到實戰(zhàn):html5網(wǎng)頁特效-水墨動畫:




效果

筆記

:root

這個 CSS 偽類匹配文檔樹的根元素。對于 HTML 來說,:root 表示元素,除了優(yōu)先級更高之外,與 html 選擇器相同。

box-sizing

屬性允許您以特定的方式定義匹配某個區(qū)域的特定元素。

content-box:在寬度和高度之外繪制元素的內邊距和邊框。
border-box:在寬度和高度之內繪制元素的內邊距和邊框。
inherit:從父元素繼承
顏色漸變linear-gradient
背景漂亮的深藍-淺藍效果就是這個的作用。具體請看http://developer.mozilla.org/zh-CN/docs/

此CSS函數(shù)讓你在聲明CSS屬性值時執(zhí)行一些計算。它可以用在如下場合:、, 、、、或。

flex:

這是一種可以自動適應不同屏幕尺寸的布局界面。下面的justify-content和align-items規(guī)定了應用flex布局的子元素的排列方式

justify-content:設置或檢索彈性盒子元素在主軸(橫軸)方向上的對齊方式。通俗一點就是左右方向。
align-items:設置或檢索彈性盒子元素在側軸(縱軸)方向上的對齊方式。通俗一點就是上下方向。
@media:
媒體查詢,簡單來說就是可以讓網(wǎng)頁自動適應不同的設備屏幕尺寸。例如上面意為當屏幕寬度小于750px時,就讓flex的方向改為縱軸排列。

rem:

是一個相對單位,相對根元素字體大小的單位,再直白點就是相對于html元素字體大小的單位。用px這種絕對單位固然方便,但當屏幕尺寸改變,就沒看看全了。rem則是一種相對單位,根據(jù)父元素的變化而變化,解決了自適應的問題。

cubic-bezier:

貝塞爾曲線,用來生成水墨效果的關鍵。

源碼:

html代碼

<!DOCTYPE html><html lang="en" ><head><meta charset="UTF-8"><title>CSS3 水墨風格背景動畫按鈕DEMO演示</title><link rel="stylesheet" href="css/style.css"></head><body><svg width="0" height="0"> <filter id="filter"> <feTurbulence type="fractalNoise" baseFrequency=".01" numOctaves="6" /> <feDisplacementMap in="SourceGraphic" scale="100" /> </filter></svg><div class="wrapper"> <div class="button _1"> <span>hover</span> <div class="back"></div> </div> <div class="button _2"> <span>hover</span> <div class="back"></div> </div> <div class="button _3"> <span>hover</span> <div class="back"></div> </div> <div class="button _4"> <span>hover</span> <div class="back"></div> </div></div><div style="text-align:center;clear:both;"><script src="/gg_bd_ad_720x90.js" type="text/javascript"></script><script src="/follow.js" type="text/javascript"></script></div></body></html>css代碼:

:root { --height: 100px; --width: 200px;}* { margin: 0; padding: 0; box-sizing: border-box;}body { width: 100%; height: 100vh; background-image: linear-gradient(to right, #4facfe 0%, #00f2fe 100%); font-family: sans-serif;}.wrapper { width: calc(4 * var(--width)); height: calc(4 * var(--height)); display: flex; justify-content: center; align-items: center;}.button { position: relative; width: calc(0.8 * var(--width)); height: calc(0.7 * var(--height)); display: flex; justify-content: center; align-items: center; cursor: pointer; overflow: hidden; margin: 0 0.8rem; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2), 0 3px 8px rgba(0, 0, 0, 0.1); transition: all 0.3s cubic-bezier(0, 0.22, 0.3, 1);}.button:before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.1);}.button span { color: #fff; font-size: 1rem; z-index: 10; text-transform: uppercase; letter-spacing: 2px;}.button._1 { background: #2980b9;}.button._2 { background: #8e44ad;}.button._3 { background: #16a085;}.button._4 { background: #e74c3c;}.button .back { position: absolute; width: 0; height: 0; filter: url(#filter); border-radius: 50%; z-index: 5; transition: all 2.5s cubic-bezier(0.1, 0.22, 0.3, 1);}.button._1 .back { left: -50%; top: -50%; background: #27ae60;}.button._2 .back { right: -50%; top: -50%; background: #c0392b;}.button._3 .back { left: -50%; bottom: -50%; background: #34495e;}.button._4 .back { right: -50%; bottom: -50%; background: #2980b9;}.button:hover .back { width: calc(2 * var(--width)); height: calc(2 * var(--height));}@media only screen and (max-width: 750px) { .wrapper { flex-direction: column; } .button { margin: 0.8rem 0; }}更多大型互聯(lián)網(wǎng)web前端實戰(zhàn)操作,在線解析,學習指導,學習資源,點:【W(wǎng)EB前端資源】

關鍵詞:入門,實戰(zhàn)

74
73
25
news

版權所有? 億企邦 1997-2025 保留一切法律許可權利。

為了最佳展示效果,本站不支持IE9及以下版本的瀏覽器,建議您使用谷歌Chrome瀏覽器。 點擊下載Chrome瀏覽器
關閉