2017-01-31 4 views
0

У меня есть два divs, которые перекрываются по горизонтали. Моя проблема заключается в том, что один из div содержит текст и ссылку href, которая не работает.Ссылка href не работает над перекрывающимися divs

Вы можете увидеть код у меня есть здесь https://jsfiddle.net/jayreis/w7regdcr/

.postwrapper 
{ 
    margin:auto; 
    width:80%; 
    display:block; 
    padding-bottom:15px; 
} 
.imageDiv 
{ 
     margin-left: 100px; 
     background: #fff; 
     display: block; 
     width: 445px; 
     height: 220px; 
     padding: 10px; 
     border-radius: 2px 2px 2px 2px; 
} 
.imageDiv img 
{ 
    width:600px; 
    height:400px; 
} 
.textboxDiv 
{ 
    position:relative; 
    bottom:145px; 
    left:470px; 
    zoom: 1; /*to fix the has layout bug in IE older version*/ 
    filter: alpha(opacity=50); 
    opacity: 0.9; 
    background-color:#ffffff; 
    text-align:center; 
} 
.textboxDiv:after 
{ 
    content:''; 
    position: absolute; 
    top: -15px; 
    left: -15px; 
    right: -15px; 
    bottom: -15px; 
    border: #dddddd 2px solid 

} 
.readarticle 
{ 
    text-decoration:none; 
    border-top: 1px solid #a61531; 
    float:left; 
    color:#000000; 
    z-index: 99999; 
} 


    <div class="postwrapper"> 
     <div class="imageDiv"> 
       <img src="http://www.ccc.com/media/post/image/6/0/600x400.png" /> 
     </div> 
     <div class="imageDiv textboxDiv"> 
      <p style="color:#000000; margin-auto; width:35%; margin-left:-10px; padding-bottom:10px">date here 
      </p> 
      <h4><a href='http://www.ccc.com' title="" style="color:#000000; font-size:15px">the title</a></h4> 
      <p style="color:#000000">desc here</p> 
      <br /> 
      <p><a href="http://www.ccc.com" title="test" class='readarticle'>READ ARTICLE</a></p> 
     </div> 
    </div> 

Так что, если вы посмотрите на CSS, если изменить позицию: абсолютная; быть позицией: относительная; в стиле класса .textboxDiv: после ссылки работает, но я теряю стиль границы, который мне нужен в этом поле.

Любые предложения, как я могу сохранить стиль, но заставить ссылки работать в текстовом поле?

ответ

1

.readarticle не расположен, поэтому индекс z не будет работать. Просто добавьте position: relative;, и это сработает.

.readarticle 
    { 
    text-decoration:none; 
    border-top: 1px solid #a61531; 
    float:left; 
    color:#000000; 
    z-index: 99999; 
+ position: relative; 
    } 

MDN Documentation: Z-Index

Смежные вопросы