2017-05-25 109 views
1

我在CSS中创建一个卡。它在Chrome中运行得非常好,但在IE/Safari浏览器中不起作用。位置粘滞不工作在IE或Safari

#nb { 
 
    position: sticky; 
 
    width: 280px; 
 
    height: 450px; 
 
    margin: 0 auto; 
 
    overflow: hidden; 
 
    text-align: center; 
 
} 
 
#nb:hover:after { 
 
    background: #f79031!important; 
 
} 
 
#nb::after { 
 
    content: ''; 
 
    position: absolute; 
 
    width: 940%; 
 
    height: 100%; 
 
    top: 170px; 
 
    right: -502%; 
 
    background: #ffffff; 
 
    transform-origin: 54% 0; 
 
    transform: rotate(129deg); 
 
    z-index: -1; 
 
} 
 

 
#nb h5{text-align: left; 
 
line-height: 25px; 
 
padding-left: 7%;}
<div id="nb"> 
 
\t <a href="http://www.wissentechnology.com/banking-financial/"><img 
 
\t \t class="bimg" 
 
\t \t src="https://wissen-kenvent.rhcloud.com/wp-content/uploads/2017/05/Banking-Financial.jpg" 
 
\t \t style="width: 100%;" /> 
 
\t \t <h5 style="font-size: x-large; color: #000000; padding-top: 15px;">Banking 
 
\t \t \t & Finance</h5> 
 
\t \t <h4 
 
\t \t \t style="color: #000000; padding-top: 15px; text-align: justify; padding-left: 7%; padding-right: 7%;">We 
 
\t \t \t bring the right mix of domain and technical expertise to help you 
 
\t \t \t take emerging imperatives head on and translate them to competitive 
 
\t \t \t advantage.</h4> </a> 
 
</div>

创建一个JSFiddle

+0

'position:sticky' is not supported by IE-> http://caniuse.com/css-sticky/embed/ – sol

回答

1

更改#nb的相对修复问题的立场。

#nb { 
    position: relative; 
    width: 280px; 
    height: 450px; 
    margin: 0 auto; 
    overflow: hidden; 
    text-align: center; 
}