z-index问题

时间:2018-05-31 04:47:29

标签: css z-index

问题是#one#three重叠。为什么z-index无效?

#one {
  position: relative;
  top: 35px;
  z-index: 2;
}
<div id="one">one</div>
<div>two</div>
<div id="three">three</div>

1 个答案:

答案 0 :(得分:-1)

<html>
<head>
<title>Page Title</title>
<style>#one{position:relative; top:35px; z-index: 1;background:white}
#three{
z-index:-3; background:white}
</style>
</head>
<body>

       <div id="one">one</div>
       <div>two</div>
       <div id="three">three</div>
   </body>
</html>