网页学习者 发表于 2014-10-5 23:18:40

背景图的设置问题background的设置

关于background的属性有很多,这里给大家详细的举几个常用的例子!1.background-color:    ;            (这里指的是背景颜色,也可以写为background)
2.background-image: url(图片地址 );      这里指的是背景图片,当同时出现背景图片和背景色的情况下,那么系统会优先选着背景图的效果
3.background-repeat: repeat-x:这里指的是设置的背景图,成X轴 显示
4.background-repeat:repeat-y:这里指的是设置的背景图,成Y轴显示
5.background-repeat:no-repeat;这里指的是设置的背景图,只显示原来的一张就可以(只显示背景图大小的,不会在X或Y轴重复)
6.background-attachment:fixed:这里指的是设置或检索设置的背景图像是否随着对象内容滚动还是固定的。




那么我写了几个代码,让大家看下


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<title>26课程背景页面的设置</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="道勤教育 http://www.daoqin.net" />
<style>
        body{
                /*background-color:red;*/
                background-image:url(small.jpg);
                background-repeat:no-repeat;

        }
</style>
</head>
    <body>
           
    </body>
</html>

页: [1]
查看完整版本: 背景图的设置问题background的设置