css - Fill image/button with colour on hover -


i'm new css & wordpress, i've spent night trying , looking solution - can me.

i have image, , when hovers on want white/see-through portion in middle fill colour #f7ca18 bottom top

http://wp.tek-monkey.com/wp-content/uploads/2015/06/circle1_test_seethrough.png

i've tried following try , simple transition white/see-through inner desired colour, none of them have worked. i'm not sure if i'm doing wrong in wordpress; under appearance>editor paste css code @ bottom, , on page image edit image , type box (image css class) .circle-testfor example.

.circle-test {   background: #ffffff;   transition-property: background;   transition-duration: 1s;   transition-timing-function: linear; } .circle-test:hover {   background: #f7ca18; } 
.circle-test:hover{     background-color: #f7ca18; } 
.circle-test{     background:none; }  .circle-test:hover{     background:#f7ca18; } 

totally doable. trick adding border-radius of 100% create circle around image. here 3 ways can this.

codepen

i cropped & re-exported image it's perfect 275px square (if ever need bg transitions on irregularly-shaped image, svg). you're more welcome download image , use instead!

i did kind of quickly, let me know if have questions!

/* option 1: image */  .circle-test {    display: block;    margin: 0 auto;    border-radius: 100%;    background-image: url('http://www.heavilyedited.com/hands-temp.png');    background-repeat: no-repeat;    -webkit-transition: background 1s linear;    -moz-transition: background 1s linear;    transition: background 1s linear;  }    .circle-test:hover {    background-color: #f7ca18;  }    /* option 2: div background image*/  .circle-test2 {    display: block;    width: 275px;    height: 275px;    margin: 0 auto;    border-radius: 100%;    background-image: url('http://www.heavilyedited.com/hands-temp.png');    background-repeat: no-repeat;    transition: background 1s linear;  }    .circle-test2:hover {    background-color: #1d9b8d;  }    /* option 3: image inside div*/  .circle-test3 {    display: block;    width: 275px;    height: 275px;    margin: 0 auto;    border-radius: 100%;    background-image: url('http://www.heavilyedited.com/hands-temp.png');    background-repeat: no-repeat;    -webkit-transition: background 1s linear;    -moz-transition: background 1s linear;    transition: background 1s linear;  }    .circle-test3:hover {    background-color: #00aeef;  }
<!-- option 1: image -->  <img src="http://www.heavilyedited.com/hands-temp.png" class="circle-test"/>    <!-- option 2: div background image -->  <div class="circle-test2">  </div>    <!-- option 3: image inside div-->  <div class="circle-test3">    <img src="http://www.heavilyedited.com/hands-temp.png" />  </div>


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -