css样式属性

1、背景

background-color:背景色

 <div style="50px; height:50px; background-color:#F00;">

background-image:背景图

<body>
   <div style="100px; height:100px; background-color:#6C3; background-image:url(lx1.png);">
    gyvgvgv
     </div>
</body>

background-repeat:no-repeat不平铺;repeat平铺;repeat-x横向平铺;repeat-y纵向平铺

<body>
    <div style="100px; height:100px; background-color:#6C3; background-image:url(lx1.png); background-repeat:no-repeat">
    <!--no-repeat不平铺;repeat平铺;repeat-x横向平铺;repeat-y纵向平铺-->
     </div>
</body>

background-position:调整背景图片位置(repeat:no-repeat);center居中;

<body>
    <div style="100px; height:100px; background-color:#6C3; background-image:url(lx1.png); background-repeat:no-repeat; background-position:center">
     </div>
</body>

background-position当设置左右必须有上下位置才起作用

<body>
    <div style="100px; height:100px; background-color:#6C3; background-image:url(lx1.png); background-repeat:no-repeat; background-position:left 10px top 10px">
     </div>
</body>

原文地址:https://www.cnblogs.com/navyouth/p/7645345.html