claudia529

CSS 背景

<style>
h1
{
    background-color:#6495ed;
}
p
{
    background-color:#e0ffff;
}
div
{
    background-color:#b0c4de;
}
</style>

背景颜色和图片插入

<style>
body 
{
    background-image:url(\'paper.gif\');
    background-color:#cccccc;
}
</style>

<style>
body
{
         background-coolor:rgb(222,222,222);
}

直接铺

<style>
body
{
    background-image:url(\'gradient2.png\');
}
</style>

水平铺

<style>
body
{
    background-image:url(\'gradient2.png\');
    background-repeat:repeat-x;
}
</style>

设置定位+不平铺

<style>
body
{
    background-image:url(\'img_tree.png\');
    background-repeat:no-repeat;
}
</style>

背景图片不重复,设置 position 实例。

背景图片只显示一次,并与文本分开。

实例中还添加了 margin-right 属性用于让文本与图片间隔开。

<style>
body
{
    background-image:url(\'img_tree.png\');
    background-repeat:no-repeat;
    background-position:right top;
    margin-right:200px;
}
</style>

 

发表于 2019-09-14 14:49  江河湖海529  阅读(137)  评论(0编辑  收藏  举报
 

分类:

技术点:

相关文章: