我对CSS和HTML5还比较新。
以下脚本有两个问题:
#someDiv中的cursor:pointer;在悬停在#anotherDiv和#someLinesDiv上时显示为指针
z-index似乎无法正常工作 - #someDiv应该在其他div上方
<body>
<table id="AlphaTable">
<tbody>
<tr>
<td>
<div id=topLevelDiv>
<div id="someDiv" />
<div id="anotherDiv">
<div>
<div id="anotherDivOval" /></div>
</div>
<div id="someLinesDiv">
<div id="someLinesDivTopLine" />
<div id="someLinesDivBottomLine" /></div>
</div>
</td>
</tr>
</tbody>
</table>
CSS
#AlphaTable {
position: relative;
}
#topLevelDiv {
position: relative;
z-index: 1;
}
#someDiv {
position: absolute;
top: 0px;
left: 0px;
height: 18px;
width: 30px;
z-index: 40;
background-color: orange;
cursor:pointer;
}
#anotherDiv {
position: absolute;
top: 10px;
left: 10px;
height: 18px;
width: 30px;
background-color: white;
z-index: 2;
}
#anotherDivOval {
position: absolute;
top: 4px;
left: 3px;
width: 20px;
height: 8px;
border-style: solid;
border-radius: 50%;
border-width: 1px;
border-color: black;
border-collapse: collapse;
/*background-color: yellow;*/
}
#someLinesDiv {
position: absolute;
top: 0px;
left: 35px;
height: 18px;
width: 30px;
border-collapse: collapse;
background-color: yellow;
}
#someLinesDivTopLine {
position: absolute;
left: -5px;
top: -19px;
width: 30px;
height: 30px;
border: 1px solid black;
border-color: transparent transparent black transparent;
border-top-left-radius: 0px;
border-top-right-radius: 0px;
border-bottom-left-radius: 30px;
border-bottom-right-radius: 0px;
background-color: yellow;
}
#someLinesDivBottomLine {
position: absolute;
left: -1px;
top: 22px;
width: 30px;
height: 30px;
border: 1px solid black;
border-color: black transparent transparent transparent;
border-top-left-radius: 30px;
border-top-right-radius: 0px;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
/*background-color: yellow;*/
}
#AlphaTable {
position: relative;
}
#AlphaTable th {
position: relative;
}
#AlphaTable tr {
position: relative;
}
#AlphaTable td {
position: relative;
}