欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!

 

Background-color: 颜色值

background-image:url(../imgs/1.jpg); 背景图,从css文件出发 去查找的*****

注意:如果背景图 元素的宽高  背景或从左上角开始截取一块

      如果背景图的宽 元素的宽 背景图 x  y  上平铺(重复)

      如果背景图和背景色同时拥有,背景图在起作用

background-attachment scroll 元素跟着背景图一起滚动 | fixed 背景图固定         背景图的附着方式

background-repeat : repeat (x y都平铺) | no-repeatx y 都不平铺) | repeat-x  x平铺) | repeat-yy平铺)

background-position: -100px(左右,正左  负右)    100px (上下  正上 负下)

background : background-color || background-image || background-repeat || background-attachment || background-position

案列

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>无标题文档</title>

<link href="css/index.css" rel="stylesheet" type="text/css" />

</head>

 

<body>

<div id="dv">今天天气不错,预计明天也不错,大家适合去和外国人交流abcdefg</div>

</body>

</html>

Css部分:

@charset "utf-8";

/* CSS Document */

div{

      border:1px solid #ff0000;

      width:200px;

      height:200px;

}

#dv{

      background-color:#F6F6F6;

      background-image:url(../imgs/1.jpg);

      background-position:  0px 100px;

}

 

 

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/rumen/r14195.shtml