Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change span background when hover parent element

Tags:

html

css

I have the following section on my website: http://jsfiddle.net/4jr2r3nq/

I'd like it if I hover over the main button that both the button & full-circle change background colour. As you can see from that example, when I hover over the main shape, only it changes background colour, not the semi-circle part :(

.full-circle {
 border: 2px solid #1588CB;
 height: 35px;
 width: 35px;
-moz-border-radius:30px;
-webkit-border-radius: 30px;
 position:absolute;
 bottom:-20px;
}

button {
background:#ffffff;
border-radius: 10px; 
-moz-border-radius: 10px; 
-webkit-border-radius: 10px; 
border: 2px solid #1588CB;
color:#1588CB;
font-weight:400;
height:200px;
width:400px;
position:relative;
}

/* overides ... */
.full-circle {
  border-radius: 0 0 30px 30px;
  border-top: none;
  height: 17px;
  background: #FFF;
  left: 50%;
  margin-left: -17px;
  bottom: -19px;
  line-height: 0;
}

button:hover, .full-circle:hover {
    background:red
}
<button>Learn More
    <span class="full-circle">+</span>
</button>
like image 916
michaelmcgurk Avatar asked Sep 16 '26 22:09

michaelmcgurk


2 Answers

Change your hovering style to this:

button:hover, button:hover > span{
    background:red
}
like image 168
Mr_Green Avatar answered Sep 19 '26 12:09

Mr_Green


use this button:hover, button:hover .full-circle {...} and by the way, according to caniuse.com , border-radius does not require vendor prefixes

like image 40
Farzad Yousefzadeh Avatar answered Sep 19 '26 12:09

Farzad Yousefzadeh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!