Log in

View Full Version : Positioning content in the middle (no movable space on right)



freeroxy
06-08-2009, 07:12 PM
Hello, thank

I'm wondering how to position the website content in the middle and how to content not movable? For example, on my website, ( www.bonniechoigallery.com) I can get empty space on the right eternally if I enlarge the window to the right side. So, all the content which supposed to be positioning in the middle don't position where it should be... also, whenever I open the window with different browser, it gets different shape and size....... I set the right and left margins to 0, but unfortunately, that seemed to not enough solution to fix this. Could you please please let me know how to fix that problem? My background body is jpeg file. And, the width of window is 1000.


Thank you so much for your help and could I look forward to hearing from you?


Best Regards and Many Thanks
Bonnie

n1tr0b
06-23-2009, 11:50 AM
use css margins mate! :D




<style type="text/css">

div {
margin-left: 150px;
margin-right: 150px;
}
</style>

<div>
This is a marginalized text :D
</div>

sniperman
06-28-2009, 01:39 PM
The simple answer to center content is to use...


<div style="margin:0 auto;background-color:red;width:600px;height:600px;">
CONTENT HERE
</div>


for the main container. I added the background color for visual effect.
margin: 0 auto; centers the container, so you should ensure the <div> contains all your other block-level elements and content. This should keep the container centered on browser resize.