CSS Z索引问题
我试图调整z索引顺序,使第一类比第二类更接近 但我一辈子都不能看到一个盒子的影子CSS Z索引问题,css,Css,我试图调整z索引顺序,使第一类比第二类更接近 但我一辈子都不能看到一个盒子的影子 .title { background-image: linear-gradient(bottom, rgb(249,252,249) 33%, rgb(255,255,255) 37%); background-image: -o-linear-gradient(bottom, rgb(249,252,249) 33%, rgb(255,255,255) 37%);
.title {
background-image: linear-gradient(bottom, rgb(249,252,249) 33%, rgb(255,255,255) 37%);
background-image: -o-linear-gradient(bottom, rgb(249,252,249) 33%, rgb(255,255,255) 37%);
background-image: -moz-linear-gradient(bottom, rgb(249,252,249) 33%, rgb(255,255,255) 37%);
background-image: -webkit-linear-gradient(bottom, rgb(249,252,249) 33%, rgb(255,255,255) 37%);
background-image: -ms-linear-gradient(bottom, rgb(249,252,249) 33%, rgb(255,255,255) 37%);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.33, rgb(249,252,249)),
color-stop(0.37, rgb(255,255,255))
);
box-shadow: 0px 1px 5px rgba(0,0,0,1);
height: 50px;
z-index: 1;
}
.banner {
background-image:url('images/grad.jpg');
background-color:#cccccc;
height: 500px;
z-index: -1;
}
但这对我不起作用
标记>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Design Test | PolyDevs</title>
<link rel="stylesheet" type="text/css" href="style.css">
<div class="header">
<div class="title">
<div class="logo">
<img src="images/banner.png"/>
</div>
</div>
</div>
</head>
<body>
<div class="banner">
</div>
</body>
</html>
设计测试| PolyDevs
位置:相对位置;修正了我的问题,为什么 绝对定位图元由一个相对定位的父图元定位 如果没有相对定位的元素,则默认相对定位的
元素将成为指定“from”位置(左、右、下、上)的父元素
示例:
<body>
<div class="posrelative">
<div class="posabsolute">hello world</div>
</div>
</body>
你好,世界
Hello world无法根据父包装器
的位置进行绝对定位,这可能是侧边栏或页脚等
<body>
<div>
<div class="posabsolute">hello world</div>
</div>
</body>
你好,世界
Hello world现在可以定位为绝对位置,但不再基于父对象的位置,而是基于
的位置,默认情况下,该位置会占据浏览器窗口的整个宽度请发布您的HTML。您也可以共享您的标记(HTML)吗z-index
就是这样,您的标记很重要……banner的父元素是否设置为位置:relative
?我知道这把我绊倒在过去的位置:亲戚;修正了我的问题,为什么?谢谢一群家伙不要在标题中添加div
。