我期待的是点击h3将允许它内部的锚点工作,但由于某种原因它没有。 我有一个小提琴演示问题在这里:https://jsfiddle.net/05fekvgy/
CSS
.sitting-timeline-bar-error {
background-color: #ec1439;
}
.sitting-timeline-item-error {
background-color: #ec1439;
}
.sitting-timeline-header-error {
color: #ec1439;
}
/* Action Class for timeline */
.sitting-timeline-bar-action {
background-color: #0c8ed9;
}
.sitting-timeline-item-action {
background-color: #0c8ed9;
}
.sitting-timeline-header-action {
color: #0c8ed9;
}
/* Positive Class for timeline */
.sitting-timeline-bar-positive {
background: #42bc8d;
}
.sitting-timeline-item-positive {
background: #42bc8d;
}
.sitting-timeline-header {
color: #42bc8d;
}
.timeline-wrapper p {
font-size: 12px;
color: #b7b7b7;
}
.timeline-wrapper h3 {
color: #efefef;
display: block;
padding: 0;
margin: auto;
text-align: center;
}
.timeline-wrapper {
margin: auto;
text-align: center;
}
.sitting-timeline-section {
position: relative;
display: inline-block;
margin-left: -4px;
width: 20%;
z-index: -2000;
}
.sitting-timeline-section-description {
position: relative;
display: inline-block;
margin-left: -4px;
width: 20%;
z-index: -2000;
padding: 10px 20px 0 20px;
vertical-align: top;
}
.sitting-timeline-bar {
background-color: #efefef;
height: 5px;
width: 100%;
position: absolute;
display: inline-block;
top: 0;
bottom: 0;
left: 0;
margin: auto;
margin-left: -1px;
z-index: -1000;
}
.sitting-timeline-section-start,
.sitting-timeline-section-end {
position: relative;
display: inline-block;
margin-left: -4px;
width: 20%;
z-index: -2000;
}
.sitting-timeline-section-start .sitting-timeline-bar {
left: 50%;
}
.sitting-timeline-section-end .sitting-timeline-bar {
width: 50%;
}
.sitting-timeline-item {
width: 65px;
height: 65px;
border-radius: 50%;
display: inline-block;
z-index: 1000;
margin: 0 auto;
background-color: #efefef;
/*@brand-unselected*/
}
HTML
<div class="container">
<div class="timeline-wrapper">
<div class="sitting-timeline-section-start timeline-section">
<div class="sitting-timeline-bar"></div>
<div class="sitting-timeline-item icon-test-title-wizard"></div>
</div>
<div class="sitting-timeline-section timeline-section">
<div class="sitting-timeline-bar"></div>
<div class="sitting-timeline-item icon-date-time-wizard"></div>
</div>
<div class="sitting-timeline-section timeline-section">
<div class="sitting-timeline-bar"></div>
<div class="sitting-timeline-item icon-students-wizard"></div>
</div>
<div class="sitting-timeline-section timeline-section">
<div class="sitting-timeline-bar"></div>
<div class="sitting-timeline-item icon-invigilation-wizard-"></div>
</div>
<div class="sitting-timeline-section-end timeline-section">
<div class="sitting-timeline-bar"></div>
<div class="sitting-timeline-item icon-summary-wizard"></div>
</div>
</div>
<div class="timeline-wrapper">
<div class="sitting-timeline-section-description">
<h3><a href="http://www.google.com">Add Title & Test</a>
</h3>
<p class="font-size-small">Give your sitting a Title (ID) & choose the test.</p>
</div>
<div class="sitting-timeline-section-description">
<h3><a href="#">Date & Time</a>
</h3>
<p class="font-size-small">Choose the date and time that you would like your sitting.</p>
</div>
<div class="sitting-timeline-section-description">
<h3>Add Students</h3>
<p class="font-size-small">Add individuals or anonymous students to your Sitting.</p>
</div>
<div class="sitting-timeline-section-description">
<h3>Invigilation mode</h3>
<p class="font-size-small">Choose the method of which you would like to invigilate this sitting.</p>
</div>
<div class="sitting-timeline-section-description">
<h3>Summary</h3>
<p class="font-size-small">Check if your details are correct then create your sitting.</p>
</div>
</div>
</div>
答案 0 :(得分:5)
.sitting-timeline-section { z-index: -2000; }
您已将其置于<body>
之后,因此当您尝试点击它时,请点击身体元素。
避免负z-索引。
答案 1 :(得分:3)
由负z-index
引起。所以从逻辑上讲,你试图减少元素在其他元素后面的堆叠顺序,并在它们上面应用点击,而不是在锚标签上。
.sitting-timeline-section-description {
z-index: -2000; /* Remove or increase to +ve value */
}
注意:多个类上有负z-index值。我刚刚指出了一次代码,请尽量避免负z-index