我正在嘗試創建麪包屑,但不幸的是z-index不起作用。我嘗試了更高的值以及重寫!重要。這裏是我的代碼:z-index僞元素不起作用
li.breadcr {
width: 2em;
height: 2em;
text-align: center;
line-height: 2em;
border-radius: 1em;
background: #0095c4;
margin: 0 3em;
display: inline-block;
color: white;
position: relative;
z-index: 900000;
}
li.breadcr::before {
content: '' !important;
position: absolute !important;
top: .9em !important;
left: -8em !important;
width: 10em !important;
height: .2em !important;
background: #0095c4 !important;
z-index: -1 !important;
}
li.breadcr:first-child::before {
display: none !important;
}
.active {
background: #0095c4;
}
.active ~ li.breadcr {
background: #badae4 !important;
}
.active ~ li.breadcr::before {
background: #badae4 !important;
}
ul.sub {
list-style: none;
}
li.sub02 {
display: inline-block;
font-family: TeX Gyre Heros, Helvetica Neue, Helvetica, Roboto, Arial, sans-serif;
}
<ul>
<li class="breadcr">1</li>
<li class="active breadcr">2</li>
<li class="breadcr">3</li>
</ul>
<ul class="sub">
<li class="sub02" style="margin-left: 25px;"><b>File or link</b>
</li>
<li class="sub02" style="margin-left: 53px;"><b>Category</b>
</li>
<li class="sub02" style="margin-left: 50px;"><b>Comments</b>
<li>
</ul>
的代碼工作單獨的HTML頁面上,但是當我有新的網站綜合它vanished.What Z-Index的值會工作的線,所以線條圓下方而不是上面? 任何建議,非常感謝。 非常感謝, Neko
我嘗試了z-index for ul,並且這些行仍然不可見@Andy Tschiersh – Neko
我已更新我的答案。 'ul'必須是'position:relative'(或絕對的或固定的,但非靜態的) –
我已經添加了相對位置,並且這些行仍然位於圓圈上方:https://ewelinawoloszyn.github.io/Form/index03。 html @Andy Tschiersch – Neko