純CSS + 媒體查詢實(shí)現(xiàn)網(wǎng)頁導(dǎo)航效果
發(fā)布時(shí)間:2018-05-02 16:31:04 作者:佚名
我要評論

這篇文章主要介紹了純CSS + 媒體查詢實(shí)現(xiàn)網(wǎng)頁導(dǎo)航效果,需要的朋友可以參考下
附上效果圖,如果大家感覺不錯(cuò),請參考實(shí)現(xiàn)代碼:
代碼如下,復(fù)制即可使用:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> body { background: #801638; } body, body > * { margin: 0; padding: 0; font-family: 'Roboto', sans-serif; font-weight: normal; } * { transition: all .3s ease 0s; } /* Background colours */ div + div article:nth-child(1) { background: #c22326; } div + div article:nth-child(2) { background: #f37338; } div + div article:nth-child(3) { background: #fdb632; } div + div article:nth-child(4) { background: #027878; } div + div article:nth-child(5), div + div { background: #801638; } /* Main layout */ html, body, div + div { width: 100vw; height: 100vh; } div + div { list-style: none; position: relative; display: flex; flex-direction: row; flex-wrap: nowrap; align-items: stretch; overflow: hidden; } /* Articles */ div + div article { flex: initial; width: 20%; height: 100%; text-align: center; color: #fff; text-decoration: none; vertical-align: bottom; box-sizing: border-box; padding: 2vh 1vw; position: relative; } /* Big Headings */ body > div:first-child { position: fixed; bottom: 8vh; background: #fff; width: 100%; text-align: center; padding: .5rem; z-index: 2; } body > div:first-child h1, body > div:first-child h2 { margin: 0; padding: 0; } /* Hover interaction */ div + div:hover article { flex: initial; width: 10%; } div + div article:hover { width: 60%; } article > div { opacity: 0; transition: opacity .2s ease 0; } div + div article:hover > div { opacity: 1; transition: opacity .3s ease .3s; } /* navigation */ div + div article > h2 { bottom: 2vh; position: absolute; text-align: center; width: 100%; margin: 0; font-size: 3vh; } /* Article layouts */ article div { text-align: left; width: 58vw; } article div p, article div div h2, article div h3 { margin: 0 0 1em 0; } article div p { width: 40vw; } @media (max-width: 900px) { div + div article { padding: 2vh 3vw; } div + div article > h2 { transform: rotate(90deg); bottom: 23vh; min-width: 12em; text-align: left; transform: rotate(-90deg); transform-origin: 0 0 0; opacity: 1; } div + div article:hover > h2 { opacity: 0; } article div p { width: 50vw; } article div { max-height: calc(72%); overflow-y: auto; } } </style> </head> <body> <div> <h1>我在這,誰敢動我。</h1> <h2>我是你們大哥的頭</h2> </div> <div> <article> <h2>大哥的小弟一</h2> <div> <h3>大哥的小弟一</h3> <p>身高180</p> <p>體重120</p> </div> </article> <article> <h2>大哥的小弟二</h2> <div> <h3>大哥的小弟二</h3> <p>身高160</p> <p>體重100</p> </div> </article> <article> <h2>大哥的小弟三</h2> <div> <h3>大哥的小弟三</h3> <p>身高175</p> <p>體重180</p> </div> </article> <article> <h2>大哥的小弟四</h2> <div> <h3>大哥的小弟四</h3> <p>身高180</p> <p>體重110</p> </div> </article> <article> <h2>大哥的小弟五</h2> <div> <h3>大哥的小弟五</h3> <p>身高180</p> <p>體重150</p> </div> </article> </div> </body> </html>
相關(guān)文章
- 這篇文章主要介紹了CSS 帶搜索導(dǎo)航欄的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)2021-02-22
html+css+js實(shí)現(xiàn)導(dǎo)航欄滾動漸變效果
這篇文章主要介紹了html+css+js實(shí)現(xiàn)導(dǎo)航欄滾動漸變效果,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-01-28css錨點(diǎn)定位被頂部固定導(dǎo)航欄遮住的解決方案
這篇文章主要介紹了css錨點(diǎn)定位被頂部固定導(dǎo)航欄遮住的解決方案,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小2020-04-09- 這篇文章主要介紹了純CSS實(shí)現(xiàn)導(dǎo)航欄下劃線跟隨效果,本文圖文并茂實(shí)例代碼詳解,給大家介紹的非常詳細(xì),需要的朋友參考下吧2019-12-09
html+css 實(shí)現(xiàn)簡易導(dǎo)航欄功能
這篇文章主要介紹了基于html+css 實(shí)現(xiàn)簡易導(dǎo)航欄功能,主要就是css(級聯(lián)樣式表)對html的內(nèi)容做格式化。具體內(nèi)容詳情大家跟隨小編一起通過本文學(xué)習(xí)吧2021-04-07CSS導(dǎo)航條菜單之帶小三角形的實(shí)現(xiàn)代碼
這篇文章主要介紹了CSS導(dǎo)航條菜單之帶小三角形的實(shí)現(xiàn)代碼,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-11-22css實(shí)現(xiàn)導(dǎo)航切換的實(shí)例代碼
本文通過實(shí)例代碼給大家介紹了css實(shí)現(xiàn)導(dǎo)航切換效果,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友參考下吧2018-08-15CSS設(shè)置列表樣式和創(chuàng)建導(dǎo)航菜單實(shí)現(xiàn)代碼
這篇文章主要介紹了CSS設(shè)置列表樣式和創(chuàng)建導(dǎo)航菜單實(shí)現(xiàn)代碼,需要的朋友可以參考下2018-07-24CSS中的導(dǎo)航欄和下拉菜單的實(shí)現(xiàn)
這篇文章主要介紹了CSS中的導(dǎo)航欄和下拉菜單的實(shí)現(xiàn)的相關(guān)資料,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-07-18- 這篇文章主要介紹了CSS3 二級導(dǎo)航的制作的示例的相關(guān)資料,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-04-02