html - Height auto doesn't work even with clearfix -


probably not first time see question... can't solve problem.

here live version http://jsfiddle.net/lndeh/

if change height .projectwrap, see trying achieve. have tried add clearfix etc.

html

<div class="projectwrap"> <img src="http://www.vectortemplates.com/raster/superman-logo-012.png"> <div class="inner"><a href=""><span>sometext</span></a></div> </div>  <div class="projectwrap"> <img src="http://www.vectortemplates.com/raster/superman-logo-012.png"> <div class="inner"><a href=""><span>some text</span></a></div> </div>   <div class="projectwrap">  <img src="http://www.vectortemplates.com/raster/superman-logo-012.png"> <div class="inner"><a href=""><span>some text</span></a></div> </div> 

css

.projectwrap { position: relative;  width: 28%; height:auto; float:left; } .projectwrap img { position: absolute; width: 100%; }  .inner { width: 100%; height: 100%; background-image: url(http://goodlogo.com/images/logos/batman_logo_2574.gif); background-size: cover; position:absolute; z-index: 11; opacity: 0; -webkit-transition: opacity 400ms linear; -o-transition: opacity 400ms linear; -moz-transition: opacity 400ms linear; transition: opacity 400ms linear; } .inner { float:left; text-align: center; display:table; width: 100%; height:100%; } .inner span { display: table-cell; vertical-align: middle; width:100%; height:100%; color:#fff; text-align: center; text-transform: uppercase; } .inner:hover { opacity: 1; -webkit-transition: opacity 400ms linear; -o-transition: opacity 400ms linear; -moz-transition: opacity 400ms linear; transition: opacity 400ms linear; } 

since containers floated , contain absolutely positioned images, have no height , float on each other.

if want 3 logos appear, change css images position:relative

.projectwrap img {     position: relative;     width: 100%; } 

http://jsfiddle.net/lndeh/1/

edit:

another method, if need use position:absolute on images:

set minimum height .projectwrap divs don't collapse 0 height.
then float expected.

.projectwrap {     position: relative;     width:28%;     float:left;     min-height:5px;height:auto!important;height:5px; } 

http://jsfiddle.net/lndeh/2/

edit:

for additional 3 (hidden) images, have changed using background image using same 100% width method used superman logos. placed links on image positioning them absolutely.

.inner {     position:relative;     width: 100%;     ... } .inner {     position:absolute;     ... } 

http://jsfiddle.net/lndeh/3/

edit:

i think see you're going for.
switched using background-image on .inner using <img /> , kept elements positioned absolutely. work better?

http://jsfiddle.net/lndeh/7/


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -