html - How to configure opacity based CSS overlay to not effect spacing of surrounding elements? -
ok, have following code: http://jsfiddle.net/q8ser/1/
so issue when hover on image, shows overlay name specific image. if name longer image width, image right pushed away , overlay isn't centered on image. expands right, not on both sides.
i can't work out how center overlay , avoid effecting divs on either side of it.
*i tried using display: none
, want preserve css3 transitions. using display: none
remove element removes css3 transition.
any ideas?
change .item_overlay
style to:
.item_overlay { height: auto; width: auto; margin: 0 auto; margin-top: -95px; position: absolute; z-index: 1; background-color: #fff; border: 1px solid rgba(0, 0, 0, 0.2); -webkit-transition: 0.3s linear; -moz-transition: 0.3s linear; -o-transition: 0.3s linear; transition: 0.3s linear; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); }
making position absolute ignores other elements position, setting negative top margin moves top. http://jsfiddle.net/q8ser/2/