html頁面背景設定相關

來源:互聯網
上載者:User

標籤:屬性   type   tle   attach   複合   傳參   寬高   預設   img   

<!DOCTYPE html><html>    <head>        <meta charset="utf-8">        <title>背景</title>                <style>            div{                width: 300px;                height: 300px;                border: 10px solid red;                background-image:url(https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493309945592&di=b3051d0bce128fd8b75d9c0b9c2ee033&imgtype=0&src=http%3A%2F%2Fpic67.nipic.com%2Ffile%2F20150514%2F21036787_181947848862_2.jpg) ;                background-size: cover;            }            /*img{                width: 100%;                height: 100%;            }*/                    </style>    </head>    <body>        <!--            若容器沒設定寬高            容器中的內容可以把容器撐起來            但背景不會佔用容器的寬高        -->    <div>        <!--<img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493309945592&di=b3051d0bce128fd8b75d9c0b9c2ee033&imgtype=0&src=http%3A%2F%2Fpic67.nipic.com%2Ffile%2F20150514%2F21036787_181947848862_2.jpg" />-->    </div>    </body></html>        <!--            background                     背景            background-color       背景色            background-image       背景圖片            background-repeat      背景圖片是否重複            background-position    背景位置            background-attachment  背景圖片是否滾動        -->            <!--                background-position:;                傳兩個參數                分別代表X和Y                可以直接傳參數例如                background-position:10px 10px;                也可以傳關鍵字                X關鍵字有:Center,left,right//分別代表中間,左邊,右邊                Y關鍵字有:top,center,bottom//分別代表上邊,中間,下邊                                若不傳參數,則預設0px 0px或者left top            -->        <!--            background-attachment:;            scoll     背景滾動(預設屬性)            fixed     背景固定        -->            <!--                背景還可以按照複合屬性寫法來寫            -->        

 

html頁面背景設定相關

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.