svenny1 Posted June 25, 2008 Share Posted June 25, 2008 Hi, i'm new to CSS, started yesterday! And have overcame some problems, but have got some problems i cannot solve.. I know that there are several errors in the code below, like doc type but i dont think that is the problem. Basically i am trying to make the main container centre in the middle of the page at 80% width, then i want the container to have a minimum width of 400px. This works perfectly in Firefox, but neither seem to work in Internet Explorer 7. Any help guys? <html> <head> <style type="text/css"> div.container { position: absolute; width:80%; min-width:400px; margin:0 auto; top:0; bottom:0; left:0; right:0; border:1px solid gray; line-height:150%; } div.header { padding:0em; color:white; background-image:url(bg.jpg); background-repeat:repeat-x; clear:both; } div.left { float:left; width:100px; margin:0; overflow:auto; } div.right { float:right; width:100px; margin:0; overflow: auto; } div.content { margin-right:100px; margin-left: 100px; border-right:1px solid gray; border-left:1px solid gray; padding:1em; } div.footer { color:white; background-image:url(bg.jpg); background-repeat:repeat-x; text-align:center; clear:both; } </style> </head> <body> <div class="container"> <div class="header"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="12%"><img src="bg.png" width="90" height="90"></td> <td width="88%" align="right" valign="bottom"><img src="title.png" align="right"></td> </tr> </table> </div> <div class="left"> Menu</div> <div class="right"> hello </div> <div class="content"> <h2>heading 2</h2> <p>the paragrapth under heading 2</p> </div> <div class="footer">Copyright footer</div> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
calabiyau Posted June 25, 2008 Share Posted June 25, 2008 I have found that with internet explorer doctype is indeed important if you want to center a div in the middle of the page. Start with xhtml strict doctype and see if that fixes your problem. Quote Link to comment Share on other sites More sharing options...
svenny1 Posted June 25, 2008 Author Share Posted June 25, 2008 i have found the problem now, thanks for any1 that looked though! Quote Link to comment Share on other sites More sharing options...
svenny1 Posted June 25, 2008 Author Share Posted June 25, 2008 I have found that with internet explorer doctype is indeed important if you want to center a div in the middle of the page. Start with xhtml strict doctype and see if that fixes your problem. Yup, that was my exact problem, just needed the strict doctype, i didn't think it was important obviously i was wrong!!, cheers mate Quote Link to comment 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.