css - Creating a hover div that matches the height and width of base div -


so have base div , hover div (will display:block in js on mouseover).

anyways i'm having hardest time making height , width of hover div match height , width of base div.

i think problem because of responsive code, in base div image on background image , width , height set 95% create border effect.

#user-options li img.role-photo {     width: 95%;     height: 95%;     padding-top: 5px; } 

i've uploaded work test link here.

as can see, on 2nd "card" have hover div showing. opaque white box 'sign in facebook' button suppose cover image of singer below. can't seem working right :(

here jsfiddle

http://jsfiddle.net/leongaban/pwvbp/

html current page:

<ul id="user-options"> <li>     <img class="role-photo" src="../images/registration_fan_tile.png" alt="fan"/>      <h3>fan</h3>     <p>calling tastemakers! influence hollywood, don't consume it. lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> </li>  <li style="">     <div class="role-card-talent" style="position: relative;">         <img class="role-photo" src="../images/registration_talent_tile.png" alt="talent"/>          <!-- hover controls -->         <div class="hover_controls" style="display:block;">              <a href="#" class="fbloginbtn"><img class="fb-signin" src="../images/registration_signin_fb.png"></a>              <div class="learn_about_pages learnmorelink" tag="" style="margin:10px">                 <a href="#"><img src="../images/registration_info_icon.png">learn more</a>             </div>         </div><!-- hover_controls -->     </div><!-- role-card-talent -->      <h3>talent</h3>     <p>oh, hai! on way being "connected." you're welcome. lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>  </li> 

css

#user-options {     margin:0px; padding:0px; float:left; width:100%; list-style-type:none; } #user-options li {     position: relative;     float:left;     width:20%; margin: 1%;     text-align: center;     padding: 5px;     background: url("../../images/one_background.png") no-repeat;     background-size: 100% auto;     overflow: hidden; } #user-options li img.role-photo {     width: 95%;     height: 95%;     padding-top: 5px; } .hover_controls {     position: absolute;     margin: 0;     top: 5px;     left: -5px;     padding: 5px;     /*padding-top: 20px;*/     width: 100%;     height: auto;     /*min-height: */     text-align: center;     color: #409ad5;     font-size: 0.875em;     font-weight: bold;     background: rgba(255,255,255,.5);     background-size: 100%; }  .hover_controls {     color: #666;     font-size: 0.750em; }  .hover_controls img.fb-signin {      width: 100%; } 

set height 100% on .hover_controls in css. see jsfiddle

http://jsfiddle.net/cornelas/pwvbp/3/

.hover_controls { position: absolute; margin: 0; top: 5px; left: -5px; padding: 5px; /*padding-top: 20px;*/ width: 100%; height: 100%; /** change 100% **/ /*min-height: */ text-align: center; color: #409ad5; font-size: 0.875em; font-weight: bold; background: rgba(255,255,255,.5); background-size: 100%; } 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -