指定具体的位置。
例:
1 <div style=”background-color:Yellow; background-image:url(mw3.jpg); background-position:right bottom; background-attachment:scroll; width:600px;height:200px;”>
2
3 </div>
4
二、一些特殊效果:
1、cursor:设置DIV上光标的样式。
2、clip:设置剪辑矩形。
例:
<div style=”font:16px 宋体;width:600px;height:200px; cursor:help; clip:rect(0px 100px 20px 0px); line-height:20px; overflow:auto;background-color:Yellow;position:absolute”>
div样式测式how areyou.
</div>
说明:clip:rect(top right bottom left);设置上下左右的距离,但此时要把position指定为absolute。看以上效果。
3、filter:滤镜效果。
例:
<div style=”width:450px;height:200px;background-color:Blue;”>
<div id=”tdiv” style=”background-color:Yellow; filter:alpha(opacity=50);opacity:0.5;
float:left; width:200px;height:200px;” >
</div>
<div style=”background-color:Yellow; width:200px;height:200px;float:left;”>
</div>
</div>
说明:设置透明度:opacity:value (FF专用,value的取值为0至1之间的小数),filter:alpha(opacity=value)(IE专用,value取值:0至100)。
如果要有JavaScript改变DIV的透明度可用下面的方法:
FF中:document.getElementById(‘tdiv’).style.opacity=’0.9′;
IE中:document.getElementById(‘tdiv’).style.filter=’alpha(opacity=90)’;
* 以下是滤镜综合的例子,将以下代码复制到一个网页文件中就可看到其效果,所以就不要加以说明了。
例:
<style type=”text/css”>
#paneldiv div
{
background-Color:yellow;
height:200px;
width:200px;
}
</style>
<div id=”paneldiv” style=”width:230px;height:2300px;
background-color:Blue;”>
<div style=”filter:alpha(opacity=0,finishopacity=80,style=1,
startx=10,starty=10,FinishX=100, FinishY=100);opacity:0.5;”>
alpha效果:
</div>
<div style=”filter:blur(add=1,direction=100,strength=5);”>
blur效果:
add为1代表字有阴影,0代表字全部模糊。
abcdefghijklmnopqrstuvwxyz
</div>
<div style=”filter:chroma(color=’#ff0000′)” onclick=”this.style.backgroundColor=’#ff0000′” ondblclick=”this.style.backgroundColor=’black’;”>
chroma效果:
原为黄色,单击变成红色变成透明,双击变成黑色。
</div>
<div style=”filter:FlipH;”>
fliph效果:
ABCDEFGH
IJKLMNOP
此属性在设置宽高后有效
</div>










