标签:
1,<div></div>一张图作为背景的用法:
必须指定width,height,background属性
.smallCircle{ margin-top: 25px; margin-left: 40%; width: 10px;height: 10px; background:url(../images/smallCirlce.png) no-repeat;}
2,div 里面的元素们都居中布局。
.fdiv{margin: 0 auto;width: 998px;height: 462px;}
3,用position: relative 准确定位
.navbg{height: 100px; position: relative; top: -12px;background: url(../images/nav_02.png) no-repeat center top;}
4,父元素相对定位,子元素绝对定位,可以使子元素相对于父元素定位,right是相对于父元素的。
.container { position:relative; width:500px; height: 20px; background-color: antiquewhite; left: 50px; } .right { position:absolute; right:0px; width:300px; background-color:#b0e0e6; } </style> </head> <body> <div class="container"> <div class="right"> <p><b>注释:</b>当使用 position 属性进行对齐时,请始终包含 !DOCTYPE 声明!如果省略,则会在 IE 浏览器中产生奇怪的结果。</p> </div> </div>
标签:
原文地址:http://www.cnblogs.com/as3lib/p/4511673.html