亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    css如何設置導航條背景圖片

    在css中,可以利用“background-image”屬性來設置導航條的背景圖片,該屬性主要用于為元素添加背景圖像,只需要給導航條元素添加“background-image:url(圖片路徑);”樣式即可。

    css如何設置導航條背景圖片

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

    css如何設置導航條背景圖片

    在css中,可以利用background-image屬性來設置導航條背景圖片,background-image 屬性為元素設置背景圖像。

    元素的背景占據(jù)了元素的全部尺寸,包括內(nèi)邊距和邊框,但不包括外邊距。

    默認地,背景圖像位于元素的左上角,并在水平和垂直方向上重復。

    下面我們通過示例來看一下怎樣利用background-image屬性來設置背景圖片,示例如下:

    首先我們創(chuàng)建一個導航條

    <!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;                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">新聞動態(tài)</a></li>    <li><a href="#contact">聯(lián)系我們</a></li>    <li><a href="#about">關于我們</a></li> </ul>    <div style="background-color:pink;height:1500px;"></div> </body> </html>

    輸出結(jié)果:

    css如何設置導航條背景圖片

    此時導航條并沒有背景圖片,只需要給導航條元素添加“background-image:url(圖片路徑);”樣式即可,示例如下:

    ul{        list-style-type: none;        overflow: hidden;        background-image:url(1118.02.png);        position: fixed;        top: 0;        width: 100%;    }

    輸出結(jié)果:

    css如何設置導航條背景圖片

    (學習視頻分享:css視頻教程)

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