Jump to content

[SOLVED] noob problems...


svenny1

Recommended Posts

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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.