CSS transform issue with an image swap and border radius simultaneously -
i'm trying find solution slight issue i'm having css. goal switch square solid colored box, centered text, circular image. while have works, albeit clunkily i'm sure, fact both colored div , image end same size, means there faint colored line surrounding image. there way remedy this? thought scale colored div @ same time, ends scaling both.
<head> <style> .images-container{ position: relative; width: 175px; height: 175px; margin-top: -191px; } .images-container > img{ display: block; width: 175px; height: 175px; position: absolute; -webkit-transition: 1s ease; -moz-transition: 1s ease; -ms-transition: 1s ease; -o-transition: 1s ease; transition: 1s ease; } .images-container > img:nth-child(1){ filter: alpha(opacity=100); opacity: 1; z-index: 0; } .images-container > img:nth-child(2){ filter: alpha(opacity=0); opacity: 0; z-index: 1; } .images-container:hover > img:nth-child(1){ filter: alpha(opacity=0); opacity: 0; z-index: 0; border-radius:50% } .images-container:hover > img:nth-child(2){ filter: alpha(opacity=100); opacity: 1; z-index: 3; border-radius:50%; } .textbg{ background: #007049; position: relative; width: 175px; height: 175px; transition:all 1s; -webkit-transition:all 1s; -moz-transition:all 1s; } .textbg:hover { border-radius:50%; } .imgtransition{ transition:all 1s; -webkit-transition:all 1s; -moz-transition:all 1s; margin-top:-191; } .textalign { color:#fff; line-height: 175px; text-align:center; } </style> <title></title> </head> <body> <div class="textbg"> <p class="textalign">family</p> <div class="images-container"><img class="imgtransition" src= "https://upload.wikimedia.org/wikipedia/commons/2/20/16x16.png"> <img class="imgtransition" src= "http://image1.masterfile.com/em_t/06/50/52/623-06505245er.jpg"></div> </div> </body> </html>
hi there add background transparent on textbg hover
example:
.textbg:hover { border-radius:50%; background:transparent; }
hope works.
Comments
Post a Comment