使用:after和:hover:在IE11中的按钮之后

时间:2015-10-01 18:55:33

标签: css internet-explorer cross-browser

我有一个动画使用的按钮:after和:hover:在CSS之后。尝试了很多方法让它在IE中工作,但无法找到解决方法。可能是因为空的内容:""或过渡,但即使没有过渡也不起作用。非常感谢任何帮助/解释。



button.bttnStyle1 {
  background: none;
  border: none;
  font-size: 14rem;
  text-transform: uppercase;
  position: relative;
  padding: 0rem;
  cursor: pointer;
}

button.bttnStyle1:after,
button.bttnStyle1::after {
  display: block;
  position: absolute;
  left: 0;
  bottom: -5rem;
  width: 3rem;
  height: 3rem;
  border-radius: 3rem;
  content: "";
  -o-transition: width 0.4s ease, height 2s ease-out;
  -moz-transition: width 0.4s ease, height 2s ease-out;
  -webkit-transition: width 0.4s ease, height 2s ease-out;
  transition: width 0.4s ease, height 2s ease-out;
}

button.bttnStyle1:hover {}

button.bttnStyle1:hover:after,
button.bttnStyle1:hover::after {
  width: 100%;
  height: 2rem;
  -o-transition: width 0.4s ease, height 2s ease-out;
  -moz-transition: width 0.4s ease, height 2s ease-out;
  -webkit-transition: width 0.4s ease, height 2s ease-out;
  transition: width 0.4s ease, height 0.2s ease;
}

button.bttnStyle1:focus {
  outline: none;
}

button.bttnColorGreen {
  color: #69e0b1;
}

button.bttnColorGreen:after{
	background-color:#69e0b1;
}

<button type="button" class="bttnStyle1 bttnColorGreen">BUTTON</button>
&#13;
&#13;
&#13;

Codepen

2 个答案:

答案 0 :(得分:1)

overflow: visible;添加到button。找到了这个解决方案here

答案 1 :(得分:0)

孤子:

CSS边框半径需要定义实际边框。溢出也需要可见,一切正常。

button.bttnStyle1:after,
button.bttnStyle1::after {
    display: block;
    position: absolute;
    left: 0;
    bottom: -5rem;
    width: 0rem;
    height: 0rem;
    line-height:0;
    border-radius:1rem;
    content: "";
    -o-transition: width 0.4s ease, height 2s ease-out;
    -moz-transition: width 0.4s ease, height 2s ease-out;
    -webkit-transition: width 0.4s ease, height 2s ease-out;
    transition: width 0.4s ease, height 2s ease-out;
}

button.bttnColorGreen:after,
button.bttnColorGreen::after{
    border:1rem solid #69e0b1;
    background-color:#69e0b1;
}