HTML連載79-背景圖片定位區域屬性、背景顏色

1、這一節講解的是背景圖片開始的位置也是能夠設置的:html

background-orgin:數值值;git

這裏的屬性值就是開始的位置,可分爲:github

 

padding-left(默認);content-box;border-box

    <style>

        *{

            margin:0;

            padding;0;

        }

        ul li{

            list-style: none;

            float:left;

            width: 200px;

            height: 200px;

            text-align:center;

            line-height:100px;

            border:10px dashed black;

            margin-left: 20px;

            background:url("image/mountain.jpg") no-repeat;

        }

        ul li:nth-child(2){

            background-origin: padding-box;/*背景圖片默認從什麼區域開始顯示,默認就是從padding區域開始顯示*/

        }

        ul li:nth-child(3){

            background-origin: border-box;

        }

        ul li:nth-child(4){

            background-origin: content-box;

        }

...............省略代碼............

<ul>

    <li>默認</li>

    <li>padding</li>

    <li>border</li>

    <li>content</li>

 

2、背景繪製區域屬性微信

與剛纔的背景圖片繪製區域定位相似,咱們只須要修改一個屬性就能夠達到定位背景顏色的目的學習

backgroud-clip:數值值;大數據

這裏的屬性值就是開始的位置,可分爲:ui

 

padding-left(默認);content-box;border-box

    <style>

        *{

            margin:0;

            padding;0;

        }

        ul li{

            list-style: none;

            float:left;

            width: 200px;

            height: 200px;

            text-align:center;

            line-height:200px;

            border:10px dashed black;

            margin-left: 20px;

            background:url("image/mountain.jpg") no-repeat;

            background-color:red;

        }

        ul li:nth-child(2){

            background-origin: padding-box;/*背景圖片默認從什麼區域開始顯示,默認就是從padding區域開始顯示*/

            background-clip:padding-box;/*背景繪製區域的屬性是專門用於制定從哪一個區域開始繪製背景的,默認狀況下就是從

            border區域開始繪製*/

        }

        ul li:nth-child(3){

            background-origin: border-box;

            background-clip:border-box;

        }

        ul li:nth-child(4){

            background-origin: content-box;

            background-clip:content-box;

        }

</style>

</head>

<body>

<ul>

    <li>默認</li>

    <li>padding</li>

    <li>border</li>

    <li>content</li>

</ul>

3、源碼:url

D190_BackgroundImageLocation.htmlspa

D191_BackgroudDrawingAttribute.html.net

D192_MoreBackgroundImage.html

地址:

https://github.com/ruigege66/HTML_learning/blob/master/D190_BackgroundImageLocation.html

https://github.com/ruigege66/HTML_learning/blob/master/D191_BackgroudDrawingAttribute.html

https://github.com/ruigege66/HTML_learning/blob/master/D192_MoreBackgroundImage.html

2.CSDN:https://blog.csdn.net/weixin_44630050

3.博客園:https://www.cnblogs.com/ruigege0000/

4.歡迎關注微信公衆號:傅里葉變換,我的帳號,僅用於技術交流,後臺回覆「禮包」獲取Java大數據學習視頻禮包

 

相關文章
相關標籤/搜索