Reputation: 6490
I am trying to apply the solution found in the this question, but it is not working in my case.
I want to bring the red circle above the green line.
.box{
border: 1px solid blue;
height: 100px;
position: relative;
width: 100px;
}
.dot{
background: red;
border-radius: 50%;
height: 30px;
width: 30px;
position: absolute;
right: -15px;
top: 50%;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
.dot:after{
background: green;
content: '';
height: 100px;
width: 10px;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
z-index: -1;
}
<div class="box">
<div class="dot"></div>
</div>
<div class="box">
<div class="dot"></div>
</div>
Upvotes: 1
Views: 195
Reputation: 78590
Can't you just make the red dot be an :after
rather than the element styles itself?
.box{
border: 1px solid blue;
height: 100px;
position: relative;
width: 100px;
}
.dot {
position: absolute;
top: 0;
right: 0;
width: 0;
height: 100%;
z-index: 1;
}
.dot:after{
background: red;
content: '';
border-radius: 50%;
height: 30px;
width: 30px;
position: absolute;
right: -15px;
top: 50%;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
.dot:before{
background: green;
content: '';
height: 100px;
width: 10px;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
<div class="box">
<div class="dot"></div>
</div>
<div class="box">
<div class="dot"></div>
</div>
Upvotes: 1