首页 > 其他 > 详细

div常用技术

时间:2015-05-18 14:36:43      阅读:175      评论:0      收藏:0      [点我收藏+]

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>

  

div常用技术

原文:http://www.cnblogs.com/as3lib/p/4511673.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!