您现在的位置:首页 >> 前端 >> 内容

HTML基础学习-15-background 背景相关属性设置

时间:2017/6/15 10:29:27 点击:

  核心提示:HTML基础学习-15-background 背景相关属性设置!DOCTYPE html!-- background背景色 bgsound background-color: red; backgro...
HTML基础学习-15-background 背景相关属性设置
<!DOCTYPE html>

<!--  
   background  背景色
   bgsound
   background-color: red;
   background-color:rgb(25,255,0);
   background-image:url(img/scenery.jpg);

   background-repeat:        repeat背景重复 repeat-x x重复  repeat-y y重复  no-repeat 不重复
    background-position:  right left  center  top  bottom
            可以两个值,第一个表示水平  第二个表示垂直,两者之间不需要逗号

            同样可以用数值表示    x坐标值  y坐标值  repeat为 no-repeat属性时候才生效
    background{
        背景颜色 url  显示背景是否重复  位置
    }       



-->


<head>
<title>背景相关属性设置</title>
<meta charset="utf-8">
<style type="text/css">
/*
    body{
        background-color:red;
        background-image:url(img/scenery.jpg);
        background-repeat:no-repeat;
        background-position:center center;
        background-position: 20px 20px;
    }
    body{
        background:#ffff11 url(img/scenery.jpg) no-repeat 20px 20px;
    }*/
    p{
        width:200px;
        height:200px;
        background:#ffff11 url(img/scenery.jpg) no-repeat 20px 20px;
    }

</style>
</head>
<body>

        <p>

        </p>

</body>






</html>

 

Tags:HT TM ML L基 
作者:网络 来源:不详