作者:电脑信息网日期:
返回目录:设置问题
<html>
<head>
<style>
body {
position:relative;
z-index:0;
}
#div1 {
width:200px;
height:100px;
background-color:red;
z-index:10;
}
#div2 {
width:150px;
height:80px;
margin:-20px 0 0 20px;
background-color:blue;
z-index:20;
}
</style>
</head>
<body>
<div id="div1">div1</div>
<div id="div2">div2</div>
</body>
</html>
这样就zhidao可以回了答
很简单,你直接在这个div上添加样式就行copy了。
<div class="3" style="width:200px;......"></div>
你看一下那个div class 3 里面都定义了哪些。
比如定义了width height padding什么,你想调整哪个,就zhidao直接在上面的style后面加就行了,会覆盖,要注意一致就OK了。
重叠在一起需要改变默认的布局百方式,将其中一个显示在上层需要设置深度度顺序,这两点分别用知如下样式完成
position: absolute; /*设置为绝对定道位*/
z-index:999; /*设置重叠的上下专次序,值越大月在上方*/
示例如下
创建Html元素
<div class="top">
属<div class="b">我是绝对定位,并且重叠在上方</div>
<div class="a">我是默认定位</div>
</div>设置css样式
div.top{margin:50px;padding:20px;width:200px;height:200px;border:2px dashed #ebbcbe;}
div.top div{width:100px;height:100px;padding:10px;color:white;}
div.a{background:red;}
div.b{background:green;position:absolute;top:100px;left:100px;z-index:999;}观察显示效果
很简单,你直接在这个div上添加zhidao样式就行了。
<div class="3" style="width:200px;......"></div>
你看一下那个div class 3 里面都定义了哪些。
比如定义了width height padding什么,你想调整哪个,就专直接在上面的style后面加就行了,会覆盖属,要注意一致就OK了。