跨度显示IE

时间:2015-06-11 11:52:47

标签: html css css3 internet-explorer

我写了这段代码,它是转换的链接

.pictos {
  display: block;
  height: 70px;
  margin: 160px 0 30px;
  padding: 0 17%;
  width: 100%;
}
.pictos > div {
  background: none repeat scroll 0 0 rgba(0, 0, 0, 0.2);
  border: 1px solid #fff;
  border-radius: 50%;
  display: table-row;
  float: left;
  height: 70px;
  width: 70px;
  margin: 0 0 0 50px;
}

/* new stuff: */
.pictos a.standard {
  background-repeat: no-repeat;
  background-color: rgba(255, 255, 255, 1);
  /* set two background images: */
  background-image: url("http://s11.postimg.org/91k4hiqe7/standard.png"), 
                    url(http://s30.postimg.org/3l9qho5h9/standard_hover.png);
  /* set positioning for them both individually: */
  background-position: 50% 50%, 50% 39px;
}
.pictos a.standard:hover,
.pictos a.standard:focus {
  /* when hovering, change background-color and both of the background-positions: */
  background-color: rgba(120, 182, 55, 1);
  background-position: 50% -39px, 50% 50%;
}
/* end of new stuff, removed some other unnecessary rules also*/

.pictos > div a {
  border-radius: 50%;
  display: inline-block;
  height: 45px;
  margin: 12px;
  text-decoration: none;
  text-indent: -9999px;
  transition: all 500ms cubic-bezier(0.645, 0.045, 0.355, 1) 0s;
  width: 45px;
}
.pictos a.standard:hover span,
.pictos a.standard span:hover,
.pictos a.standard span:focus,
.pictos a.standard:focus span {
  display: block;
  opacity: 1;
}
.pictos a span::after {
  -moz-border-bottom-colors: none;
  -moz-border-left-colors: none;
  -moz-border-right-colors: none;
  -moz-border-top-colors: none;
  border-color: #78b637 rgba(120, 182, 55, 0) rgba(120, 182, 55, 0);
  border-image: none;
  border-style: solid;
  border-width: 6px;
  content: " ";
  height: 0;
  left: 50%;
  margin-left: -6px;
  pointer-events: none;
  position: absolute;
  top: 100%;
  width: 0;
}
.pictos a span {
  background: none repeat scroll 0 0 #78b637;
  border: medium none;
  border-radius: 9px;
  bottom: 50px;
  color: #efefef;
  font-family: "Montserrat-Regular", sans-serif;
  font-size: 13px;
  padding: 5px 0;
  position: relative;
  right: 77px;
  text-align: center;
  text-decoration: none;
  text-indent: 0;
  text-transform: uppercase;
  width: 200px;
}
<div class="pictos">
  <div>
    <a href="#" class="standard">
      <span>standard</span>
    </a>
  </div>
</div>

它完全适用于Chrome,Firefox,Opera,但不适用于IE甚至IE Edge。

我知道问题出现在这段代码中

.pictos a.standard:hover span,
.pictos a.standard span:hover,
.pictos a.standard span:focus,
.pictos a.standard:focus span {
     display: block;
     opacity: 1;
}

但我不知道如何在IE上解决这个问题

感谢您的帮助!

1 个答案:

答案 0 :(得分:2)

IE中的问题似乎是由于.pictos a spanposition: relative;。可以通过使用position: absolute;代替

将其从文档流程中删除来解决此问题
  • position: relative;添加到.pictos > div a以定位相对于span的{​​{1}}
  • position: relative;
  • 上将position: absolute;更改为.pictos a span
  • 修改bottom上的right.pictos a span以相应地定位
  • display: none;添加到.pictos a span以隐藏它直至悬停

.pictos {
  display: block;
  height: 70px;
  margin: 160px 0 30px;
  padding: 0 17%;
  width: 100%;
}
.pictos > div {
  background: none repeat scroll 0 0 rgba(0, 0, 0, 0.2);
  border: 1px solid #fff;
  border-radius: 50%;
  display: table-row;
  float: left;
  height: 70px;
  width: 70px;
  margin: 0 0 0 50px;
}
/* new stuff: */

.pictos a.standard {
  background-repeat: no-repeat;
  background-color: rgba(255, 255, 255, 1);
  /* set two background images: */
  background-image: url("http://s11.postimg.org/91k4hiqe7/standard.png"), url(http://s30.postimg.org/3l9qho5h9/standard_hover.png);
  /* set positioning for them both individually: */
  background-position: 50% 50%, 50% 39px;
}
.pictos a.standard:hover,
.pictos a.standard:focus {
  /* when hovering, change background-color and both of the background-positions: */
  background-color: rgba(120, 182, 55, 1);
  background-position: 50% -39px, 50% 50%;
}
/* end of new stuff, removed some other unnecessary rules also*/

.pictos > div a {
  border-radius: 50%;
  display: inline-block;
  height: 45px;
  margin: 12px;
  text-decoration: none;
  text-indent: -9999px;
  transition: all 500ms cubic-bezier(0.645, 0.045, 0.355, 1) 0s;
  width: 45px;
  position: relative;
}
.pictos a.standard:hover span,
.pictos a.standard span:hover,
.pictos a.standard span:focus,
.pictos a.standard:focus span {
  display: block;
  opacity: 1;
}
.pictos a span::after {
  -moz-border-bottom-colors: none;
  -moz-border-left-colors: none;
  -moz-border-right-colors: none;
  -moz-border-top-colors: none;
  border-color: #78b637 rgba(120, 182, 55, 0) rgba(120, 182, 55, 0);
  border-image: none;
  border-style: solid;
  border-width: 6px;
  content: " ";
  height: 0;
  left: 50%;
  margin-left: -6px;
  pointer-events: none;
  position: absolute;
  top: 100%;
  width: 0;
}
.pictos a span {
  background: none repeat scroll 0 0 #78b637;
  border: medium none;
  border-radius: 9px;
  bottom: 75px;
  color: #e5efef;
  font-family: "Montserrat-Regular", sans-serif;
  font-size: 13px;
  padding: 5px 0;
  position: absolute;
  right: 50%;
  margin-right: -100px;
  text-align: center;
  text-decoration: none;
  text-indent: 0;
  text-transform: uppercase;
  width: 200px;
  display: none;
}
<div class="pictos">
  <div>
    <a href="#" class="standard">
      <span>standard</span>
    </a>
  </div>
</div>