javascript - How can I add link on the background banner? -


how can add link on background banner displayed in background of whole page?

.wrapper {    width: 100%;    display: inline-block;    text-align: center;  }    .banner {    background-position: 50% 0;    background-repeat: no-repeat;  }    .banner {    background-image: url(https://s15.postimg.org/n11a3vr8b/image.jpg);    background-repeat: repeat-y;  }    .wrapper.banner {    background-image: url(https://s10.postimg.org/hyzxs6mmx/image.png);    background-repeat: no-repeat;  }    .banner-link {    position: absolute;    width: 100%;    display: block;    margin: 0 auto;    height: 200px;  }    .page-content {    background-color: white;    width: 300px;    display: inline-block;  }
<div class="banner">    <div class="wrapper banner">    <a href="#" class="banner-link"></a>      <div class="page-content">        lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor        in reprehenderit in <a href="# ">lorem link</a>voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.        <a href="#">lorem link</a>lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo        consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. lorem ipsum dolor sit        amet, <a href="#">lorem link</a>consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute        irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <a href="#">lorem link</a>excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>    </div>  </div>

link should on background banner div “banner” , height of banner shouldn’t fixed.

if put absolute div “banner-link” inside div “banner” have put fixed height , not working me.

can done css or should use javascript?

you can set height of link 100% , increase z-index of page-content div. way link stay background:

    .wrapper {   width: 100%;   display: inline-block;   text-align: center; }  .banner {   background-position: 50% 0;   background-repeat: no-repeat; }  .banner {   background-image: url(https://s15.postimg.org/n11a3vr8b/image.jpg);   background-repeat: repeat-y; }  .wrapper.banner {   background-image: url(https://s10.postimg.org/hyzxs6mmx/image.png);   background-repeat: no-repeat; }  .banner-link {   position: absolute;   width: 100%;   display: block;   margin: 0 auto;   height: 100%; }  .page-content {   background-color: white;   width: 300px;   display: inline-block;   z-index:1;   position:relative; } 

http://codepen.io/anon/pen/zpgpaa


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -