html - Keep close button on upper right corner even when image scales -
how heck can keep close button on right top corner of image when scale image using css? scale in terms of when user make browser different size image scaled. p.s. how come when use full_close {left:0px;} lose image jsfiddle
.fit { max-width: 100%; } .center { display: block; top: 0px; right: 0; } .right { position: relative; right: 0; } #full_image { width: 0px; height: 0px; left: 0px; position: absolute; opacity: 1; z-index: 9; } #full_image img { left: 0px; position: fixed; overflow: hidden; } #full_image ul { width: 0px; height: 0px; list-style: none outside none; position: relative; overflow: hidden; } #full_image li:first-child { display: list-item; position: absolute; } #full_image li { position: absolute; display: none; } #full_image .full_close{ background-color:yellow; top: 10px; cursor: pointer; height: 29px; opacity: 1; position: absolute; width: 29px; z-index: 999; left: 0px; } <div id="full_image"> <ul><li><img class="center fit right" src="http://cdn.funkyspacemonkey.com/wp-content/uploads/2013/06/steve-wozniak-white-iphone-4.jpg"/></li></ul> <span> <a href="#" class="full_close "></a></span> </div>
well you've got lot of unnecessary styles , elements. check out updated example, should need: http://jsfiddle.net/dmepf/34/
<div id="full_image"> <img src="http://cdn.funkyspacemonkey.com/wp-content/uploads/2013/06/steve-wozniak-white-iphone-4.jpg"/> <a href="#" class="full_close">x</a> </div>
and css:
#full_image { position: relative; display: inline-block; max-width: 100%; } #full_image img { max-width: 100%; } #full_image .full_close{ background-color:yellow; top: 10px; cursor: pointer; height: 29px; opacity: 1; position: absolute; width: 29px; z-index: 999; right: 10px; color: #222; text-decoration: none; text-align: center; line-height: 28px; }
Comments
Post a Comment