Raya Deleva’s Web

/ CSS

CSS absolute center

I had half day problems and wondering how to center one "under construction" picture with CSS only, before near one month. And here is what I found as a decision. I haven't tеsted it with MAC browsers and the most problematic one - IE5 for me.

body { 
	background-color: #fff; 
} 
#center {   
	width:680px;   
	height:540px;  
	position:absolute; 
	top:50%;   
	left:50%;   
	margin:-270px auto auto -340px;   
	text-align:center; 
} 
....
<div id="center">  
	<img src="img.jpg" width="680" height="540" />  
</div> 
.... 
category: CSS, posted date: 18.05.2006, Comment

Add your comment here.

Your name*

Your email

Your comments, suggestions, compliments or maybe other?*


What is this blog about? - A blog about sharing wisdoms mostly connected with web development. I truly hope that you will find something useful here. Cheers, Raya.
» About
» Playlist (Social music experiment)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 Subscribe

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CSS Beauty A List Apart W3schools The best forum for development in Bulgarian CSS Zen Garden Photo Cult PEAR - PHP Extension and Application Repository Rapid development framework for PHP
My lovely friend Bobbyta Awesome! - Mootools Smashing Magazine