html - CSS button with folded corner effect and animations -


i used code below create effect on folded corner button, can not avoid white background in upper left corner of button. class use make transparent part , show yellow color, background of main div?

http://codepen.io/rsvaz83/pen/aorzby

.back {    background: #fc0;  }  .button {    display: inline-block;    padding: 1em;    margin: 1em;    background-color: #007e9f;    text-decoration: none;    color: white;  }  .curl-top-left {    display: inline-block;    position: relative;    -webkit-transform: translatez(0);    transform: translatez(0);    box-shadow: 0 0 1px rgba(0, 0, 0, 0);  }  .curl-top-left:before {    pointer-events: none;    position: absolute;    content: '';    height: 0;    width: 0;    top: 0;    left: 0;    /* ie9 */    background: linear-gradient(135deg, white 45%, #aaaaaa 50%, #cccccc 56%, white 80%);    filter: progid: dximagetransform.microsoft.gradient(gradienttype=0, startcolorstr='#ffffff', endcolorstr='#000000');    /*for ie7-8-9*/    z-index: 1000;    box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.4);    -webkit-transition-duration: 0.3s;    transition-duration: 0.3s;    -webkit-transition-property: width, height;    transition-property: width, height;  }  .curl-top-left:hover:before,  .curl-top-left:focus:before,  .curl-top-left:active:before {    width: 40px;    height: 40px;  }
<div class="back">    <a href="#" class="button curl-top-left">button effect</a>  </div>

just change 1st white #fc0 (the color of background bar) in line below.

background: linear-gradient(135deg, white 45%, #aaaaaa 50%, #cccccc 56%, white 80%);                                     ^^^^^ 

i simplified css slightly, merged transition rules, , remove filter hack, won't able effect want on outdated ies anyway, updated code snippet follows.

.back {    background: #fc0;  }  .button {    display: inline-block;    padding: 1em;    margin: 1em;    background-color: #007e9f;    text-decoration: none;    color: white;  }  .curl-top-left {    display: inline-block;    position: relative;    -webkit-transform: translatez(0);    transform: translatez(0);    box-shadow: 0 0 1px rgba(0, 0, 0, 0);  }  .curl-top-left:before {    pointer-events: none;    position: absolute;    content: '';    height: 0;    width: 0;    top: 0;    left: 0;    z-index: 1000;    background: linear-gradient(135deg, #fc0 45%, #aaa 50%, #ccc 50%, #fff 80%);    box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.4);    transition: 0.3s;  }  .curl-top-left:hover:before,  .curl-top-left:focus:before,  .curl-top-left:active:before {    width: 40px;    height: 40px;  }
<div class="back">    <a href="#" class="button curl-top-left">button effect</a>  </div>


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -