欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          css怎么把導(dǎo)航欄固定住

          在css中,可以利用position屬性把導(dǎo)航欄固定住,只需要給導(dǎo)航欄元素添加“position:fixed;”樣式,將導(dǎo)航欄相對(duì)于瀏覽器窗口進(jìn)行固定定位即可,這樣被固定的導(dǎo)航欄元素就不會(huì)隨著滾動(dòng)條的拖動(dòng)而改變位置。

          css怎么把導(dǎo)航欄固定住

          本教程操作環(huán)境:windows7系統(tǒng)、CSS3&&HTML5版、Dell G3電腦。

          css怎么把導(dǎo)航欄固定住

          可以給導(dǎo)航欄添加固定定位是導(dǎo)航來固定住。語法為“position:fixed;”。

          示例如下:

          <!DOCTYPE html> <html lang="en"> <head>   <meta charset="UTF-8">   <meta name="viewport" content="width=device-width, initial-scale=1.0">   <meta http-equiv="X-UA-Compatible" content="ie=edge">   <title>Document</title>   <style type="text/css">     *{margin:0;padding: 0;}    ul{        list-style-type: none;        overflow: hidden;        background-image:url(1118.02.png);        position: fixed;        top: 0;        width: 100%;            }      li {        float: left;    }       li a {        display: block;        color: white;        text-align: center;        padding: 14px 16px;        text-decoration: none;    }       li a:hover{        background-color: red;    }    </style> </head> <body> <ul>    <li><a href="#home">首頁</a></li>    <li><a href="#news">新聞動(dòng)態(tài)</a></li>    <li><a href="#contact">聯(lián)系我們</a></li>    <li><a href="#about">關(guān)于我們</a></li> </ul>    <div style="background-color:pink;height:1500px;"></div> </body> </html>

          輸出結(jié)果:

          css怎么把導(dǎo)航欄固定住

          (學(xué)習(xí)視頻分享:css視頻教程)

          贊(0)
          分享到: 更多 (0)
          網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)