I am having trouble getting :hover
to work with a CSS pie slice I made. I'm using transparent borders and the border-radius
property to make my div look like 1/4 of a pie. However, any styles I try to use for the hover state just don't work. I'm guessing it has something to do with the div having height: 0;
and width: 0;
, but I don't know how to fix this...Here's my code:
div {
position: absolute;
right: 0;
left: 0;
margin: 0 auto;
width: 0;
height: 0;
border-radius: 50%;
}
.circle-1 {
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 50px solid transparent;
border-top: 50px solid green;
}
.circle-1:hover {
border-top: 50px solid pink;
cursor: pointer;
}
.circle-2 {
border-left: 50px solid transparent;
border-right: 50px solid red;
border-bottom: 50px solid transparent;
border-top: 50px solid transparent;
}
.circle-3 {
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 50px solid blue;
border-top: 50px solid transparent;
}
.circle-4 {
border-left: 50px solid orange;
border-right: 50px solid transparent;
border-bottom: 50px solid transparent;
border-top: 50px solid transparent;
}
<div class="circle-1"></div>
<div class="circle-2"></div>
<div class="circle-3"></div>
<div class="circle-4"></div>