我不得不承認,這個應該很容易,但我的大腦似乎可以解決這個問題。從我對Z指數的理解。這codepen應該工作,但它不是,我不知道爲什麼。也許codepen有問題嗎?Z-index不起作用(在codepen中,也許)
https://codepen.io/mrowka3d/pen/bWZGWL?editors=0100
上面codepen具有中心內容和它周圍的三個較小的圓。較小的圓圈應位於較大的中心圓下方。但我似乎無法讓他們去,我不知道爲什麼。
只是那些日子我猜:)
感謝您抽空看看一個
HTML:
<div class="infographic">
<div class="infographic__callout infographic__callout-position1">1</div>
<div class="infographic__center">
<div class="center__title"><span class="center__serif-font">why</span> <br><span class="color2">companies<br> partner</span><br> <span class="center__serif-font">with</span> <span>PDAK</span></div>
<div class="center__cta">Find out</div>
</div>
<div class="infographic__callout infographic__callout-position2">2</div> <!-- I even tried placing them before and after the center div -->
<div class="infographic__callout infographic__callout-position3">3</div>
</div>
CSS:
.infographic {
width: 100%;
position: relative;
padding-top: 50px;
z-index: 1;
}
.infographic__center {
width: 375px;
height: 375px;
margin: 0 auto;
border-radius: 50%;
background: #f6f6f6;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
flex-flow: column wrap;
color: #4f2582;
font-family: "Roboto", Tahoma, helvetica, arial, sans-serif;
text-transform: uppercase;
font-size: 22px;
font-weight: bold;
letter-spacing: 0.18em;
line-height: 1.5em;
z-index: 20; /* this doesn't seem to do anything */
}
.center__serif-font {
font-family: Georgia, serif;
font-style: italic;
text-transform: none;
letter-spacing: 0em;
font-size: 24px;
font-weight: normal;
}
.color2 {
color: #16c1b7;
}
.center__cta {
font-size: 80%;
letter-spacing: 0em;
font-weight: normal;
position: relative;
cursor: pointer;
margin-top: 10px;
}
.center__cta:after {
content: ">";
position: absolute;
transform: rotate(90deg);
width: 0;
left: 50%;
bottom: -20px;
font-size: 30px;
}
.infographic__callout {
position: absolute;
width: 186px;
height: 186px;
border: 1px solid #cacaca;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
}
.infographic__callout-position1 {
left: 65%;
top: 23%;
margin: -93px;
}
.infographic__callout-position2 {
right: 70%;
bottom: 30%;
margin: -93px;
}
.infographic__callout-position3 {
left: 50%;
bottom: -10%;
margin: -93px;
}
甜蜜的,謝謝!我從來沒有意識到定位效果Z指數。 – Gregg