KOMPX.COM or COMPMISCELLANEA.COM   

CSS centering image

CSS horizontal centering of an image. Example:

HTML code:


<div class="example">
	<img src="image.jpg" alt="" />
</div>

CSS code:


.example img {display: block; margin: 0 auto;}

Browser support
Windows
Internet Explorer 6.0+
Firefox 1.0+
Google Chrome
Opera 5.0+ ( Opera 4.0+ if shorthand CSS is not used )
Safari 3.1+
SeaMonkey 1.0+
Mozilla 0.6+
Netscape 6.01+
Linux
Firefox 1.0+
Google Chrome / Chromium
Opera 5.0+
SeaMonkey 1.0+
NetSurf 2.6+
Hv3
Mozilla 0.6+
Netscape 6.01+
More