/ Published in: CSS
A in IE6 will annoyingly put about 3 pixels of space around a contained image. This leaves a gap between that div and any neighboring divs. To workaround you can specify a margin of 5px or so on the side where the gap must be removed, then specify an equivalent negative margin on the neighbor to remove the gap. Tested with IE6 and Firefox 2.0.0.11.
Expand |
Embed | Plain Text
<html> <head> <style type="text/css"> .badDiv { background-color: green; margin: 0px 0px 0px 0px; width: 100px; height: 100px; float: left; padding: 0px; } .goodDiv { background-color: green; margin: 0px -5px 0px 0px; width: 100px; height: 100px; float: left; padding: 0px; } .badImg { border: 0px; margin: 0px 0px 0px 0px; width: 100px; height: 100px; float: left; } .goodImg { border: 0px; margin: 0px 0px 0px 5px; width: 100px; height: 100px; float: left; } </style> </head> <body> <div> <div class="badDiv"></div> <img class="badImg" src="blackbox.gif" /> </div> <div style="clear:both"> <br/> <div class="goodDiv"></div> <img class="goodImg" src="blackbox.gif" /> </div> </body> </html>
You need to login to post a comment.
