ashrobbins87 Posted March 12, 2009 Share Posted March 12, 2009 I am designing a website where I want the content as a whole to be centrally aligned on the page so that it is in the middle no matter what size the user's monitor is. At the moment I've got a toolbar which I can centralise, and I want to align some text with the left hand side of the toolbar. How do I do this? Because surely if I position it exactly using pixels, it will be different for different size monitors? The only other option I can think of is to make a table and put the toolbar in one <tr> and the text above it in the first <td> on the left. Any suggestions would be welcome! Thanks Quote Link to comment https://forums.phpfreaks.com/topic/149114-solved-positioning-in-the-web-browser/ Share on other sites More sharing options...
lonewolf217 Posted March 12, 2009 Share Posted March 12, 2009 use CSS Quote Link to comment https://forums.phpfreaks.com/topic/149114-solved-positioning-in-the-web-browser/#findComment-782968 Share on other sites More sharing options...
ashrobbins87 Posted March 12, 2009 Author Share Posted March 12, 2009 well yeah that what I meant by positioning it by the pixel distance from the edge, but surely different monitor sizes will mess it up??? Quote Link to comment https://forums.phpfreaks.com/topic/149114-solved-positioning-in-the-web-browser/#findComment-782973 Share on other sites More sharing options...
JonnoTheDev Posted March 12, 2009 Share Posted March 12, 2009 Post on the CSS forums, this topic is not associated with php Quote Link to comment https://forums.phpfreaks.com/topic/149114-solved-positioning-in-the-web-browser/#findComment-782979 Share on other sites More sharing options...
ashrobbins87 Posted March 12, 2009 Author Share Posted March 12, 2009 Thanks for the "help" Quote Link to comment https://forums.phpfreaks.com/topic/149114-solved-positioning-in-the-web-browser/#findComment-782980 Share on other sites More sharing options...
Philip Posted March 12, 2009 Share Posted March 12, 2009 http://locusmeus.com/html-css/centerexample3.html Quote Link to comment https://forums.phpfreaks.com/topic/149114-solved-positioning-in-the-web-browser/#findComment-783009 Share on other sites More sharing options...
wemustdesign Posted March 12, 2009 Share Posted March 12, 2009 If you want all of the content to be centered just put a wrapper div round: <div id="wrapper"> Your content </div> css: #wrapper {margin:0; margin:auto;} This will center everything Quote Link to comment https://forums.phpfreaks.com/topic/149114-solved-positioning-in-the-web-browser/#findComment-783057 Share on other sites More sharing options...
ashrobbins87 Posted March 15, 2009 Author Share Posted March 15, 2009 This still wont work for me in IE....... Quote Link to comment https://forums.phpfreaks.com/topic/149114-solved-positioning-in-the-web-browser/#findComment-785280 Share on other sites More sharing options...
wildteen88 Posted March 15, 2009 Share Posted March 15, 2009 This still wont work for me in IE....... Make sure you're using a valid DOCTYPE at the start of your HTML. Also you'll need to set a width to your #wrapper too. Quote Link to comment https://forums.phpfreaks.com/topic/149114-solved-positioning-in-the-web-browser/#findComment-785284 Share on other sites More sharing options...
ashrobbins87 Posted March 15, 2009 Author Share Posted March 15, 2009 wow thanks, inserting a DOCTYPE at the top of the code has worked! Could someone explain why that makes a difference to IE? Quote Link to comment https://forums.phpfreaks.com/topic/149114-solved-positioning-in-the-web-browser/#findComment-785287 Share on other sites More sharing options...
wildteen88 Posted March 15, 2009 Share Posted March 15, 2009 You should always define a DOCTYPE for any HTML page. Without it your browser goes into a non standards mode called quirks mode, which can produce unexpected results. Quote Link to comment https://forums.phpfreaks.com/topic/149114-solved-positioning-in-the-web-browser/#findComment-785298 Share on other sites More sharing options...
seaweed Posted March 21, 2009 Share Posted March 21, 2009 This still wont work for me in IE....... Make sure you're not using IE. Fixed it for ya. Quote Link to comment https://forums.phpfreaks.com/topic/149114-solved-positioning-in-the-web-browser/#findComment-790494 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.