position compatibility for IE and Firefox
- mindfullsilence
- Professor


- Joined: Aug 04, 2008
- Posts: 846
- Status: Offline
I did the searches for positioning in the forum but they're all telling me not to use position: absolute; instead to use inline, unfortunately I don't think I can do this because I need a container div around all my contents to position everything in the center. The problem is my "content" and "navbar" divs are way too high in IE but are positioned where they should be in firefox.
html:
CSS:
any ideas?
here's a link so you can see on both browsers http://mindfullsilence.angelfire.com/#
html:
Code: [ Select ]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>BorgBand.com We Are Borg!</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="loadContent.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body onload="loadContent('page_home.html', 'content');">
<div id="horizon">
<div id="inset">
<div id="imghorizon">
<img src="images/background.jpg" id="bgimage" />
</div>
<div id="container">
<table cellspacing="0" cellpadding="0">
<tr>
<td rowspan="2">
<div id="content"> </div> </td>
</tr>
<tr>
<td>
<div id="navbar">
<p>-----------</p>
<p><a href="#" onclick="loadContent('page_home.html', 'content');">Home</a></p>
<p>-----------</p>
<p><a href="#" onclick="loadContent('page_events.html', 'content');">Upcoming Events</a></p>
<p>-----------</p>
<p><a href="#" onclick="loadContent('page_about.html', 'content');">About The Band</a></p>
<p>-----------</p>
<p><a href="#" onclick="loadContent('page_sponsors.html', 'content');">Sponsors</a></p>
<p>-----------</p>
<p><a href="#" onclick="loadContent('page_contact.html', 'content');">Contact Us</a></p>
<p>-----------</p>
</div> </td>
</tr>
</table>
</div>
</div>
</div>
</body>
</html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>BorgBand.com We Are Borg!</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="loadContent.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body onload="loadContent('page_home.html', 'content');">
<div id="horizon">
<div id="inset">
<div id="imghorizon">
<img src="images/background.jpg" id="bgimage" />
</div>
<div id="container">
<table cellspacing="0" cellpadding="0">
<tr>
<td rowspan="2">
<div id="content"> </div> </td>
</tr>
<tr>
<td>
<div id="navbar">
<p>-----------</p>
<p><a href="#" onclick="loadContent('page_home.html', 'content');">Home</a></p>
<p>-----------</p>
<p><a href="#" onclick="loadContent('page_events.html', 'content');">Upcoming Events</a></p>
<p>-----------</p>
<p><a href="#" onclick="loadContent('page_about.html', 'content');">About The Band</a></p>
<p>-----------</p>
<p><a href="#" onclick="loadContent('page_sponsors.html', 'content');">Sponsors</a></p>
<p>-----------</p>
<p><a href="#" onclick="loadContent('page_contact.html', 'content');">Contact Us</a></p>
<p>-----------</p>
</div> </td>
</tr>
</table>
</div>
</div>
</div>
</body>
</html>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>BorgBand.com We Are Borg!</title>
- <link href="style.css" rel="stylesheet" type="text/css" />
- <script src="loadContent.js" type="text/javascript"></script>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- </head>
- <body onload="loadContent('page_home.html', 'content');">
- <div id="horizon">
- <div id="inset">
- <div id="imghorizon">
- <img src="images/background.jpg" id="bgimage" />
- </div>
- <div id="container">
- <table cellspacing="0" cellpadding="0">
- <tr>
- <td rowspan="2">
- <div id="content"> </div> </td>
- </tr>
- <tr>
- <td>
- <div id="navbar">
- <p>-----------</p>
- <p><a href="#" onclick="loadContent('page_home.html', 'content');">Home</a></p>
- <p>-----------</p>
- <p><a href="#" onclick="loadContent('page_events.html', 'content');">Upcoming Events</a></p>
- <p>-----------</p>
- <p><a href="#" onclick="loadContent('page_about.html', 'content');">About The Band</a></p>
- <p>-----------</p>
- <p><a href="#" onclick="loadContent('page_sponsors.html', 'content');">Sponsors</a></p>
- <p>-----------</p>
- <p><a href="#" onclick="loadContent('page_contact.html', 'content');">Contact Us</a></p>
- <p>-----------</p>
- </div> </td>
- </tr>
- </table>
- </div>
- </div>
- </div>
- </body>
- </html>
CSS:
Code: [ Select ]
*{
margin: 0;
padding: 0;
z-index: 1;
}
body{
background-color:#000066;
color: #CCCCCC;
overflow: hidden;
background-image: url(images/bgstripe.jpg);
}
a{
color: #CCCCCC;
}
a:hover{
color: #CC6633;
}
#horizon{
position: absolute;
top: 50%;
width: 100%;
height: 1px;
overflow: visible;
}
#inset{
width:800px;
height: 200px;
position: absolute;
left: 50%;
margin-left: -400px;
top: -400px;
overflow: visible;
}
#bgimage{
overflow: visible;
z-index: -1;
width: 800px;
height: 600px;
}
#imghorizon{
position: absolute;
top: 50%;
width: 100%;
height: 1px;
overflow: visible;
z-index: -2;
}
#container{
width: 800px;
height: 100%;
padding-left: 30px;
padding-top: 190px;
margin-left: 0px;
margin-top: 10%;
}
#content{
padding-left: 10px;
margin-top: 40px;
width: 510px;
height: 400px;
margin-right: 30px;
padding-top: 0px;
font-family: Arial, Helvetica, sans-serif;
background-color: transparent;
}
.contentcell{
margin-top: 20px;
overflow: scroll;
height: 235px;
width: 500px;
overflow: scroll;
overflow-x: hidden;
overflow-y: inherit;
background-color: transparent;
}
#navbar{
padding-left: 10px;
padding-top: 0px;
width: 180px;
margin-left: 10px;
}
#navbar a:link, a:visited{
color:#CCCCCC;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
font-size: small;
}
#navbar a:hover{
background-color: #993300;
border: dashed thin #FF0000;
color: #CCCCCC;
}
#aboutnavbar a:link, a:visited{
color:#CCCCCC;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
text-align: center;
}
#aboutnavbar a:hover{
background-color: #993300;
border: dashed thin #FF0000;
color: #CCCCCC;
text-align: center;
}
#abouttext{
padding-top: 15px;
}
.abouttextcell{
height: 233px;
overflow: scroll;
overflow-x: hidden;
overflow-y: inherit;
padding-left: 15px;
}
.aboutpics{
height: 234px;
width: 124px;
border: #B4B4B4 medium solid;
}
margin: 0;
padding: 0;
z-index: 1;
}
body{
background-color:#000066;
color: #CCCCCC;
overflow: hidden;
background-image: url(images/bgstripe.jpg);
}
a{
color: #CCCCCC;
}
a:hover{
color: #CC6633;
}
#horizon{
position: absolute;
top: 50%;
width: 100%;
height: 1px;
overflow: visible;
}
#inset{
width:800px;
height: 200px;
position: absolute;
left: 50%;
margin-left: -400px;
top: -400px;
overflow: visible;
}
#bgimage{
overflow: visible;
z-index: -1;
width: 800px;
height: 600px;
}
#imghorizon{
position: absolute;
top: 50%;
width: 100%;
height: 1px;
overflow: visible;
z-index: -2;
}
#container{
width: 800px;
height: 100%;
padding-left: 30px;
padding-top: 190px;
margin-left: 0px;
margin-top: 10%;
}
#content{
padding-left: 10px;
margin-top: 40px;
width: 510px;
height: 400px;
margin-right: 30px;
padding-top: 0px;
font-family: Arial, Helvetica, sans-serif;
background-color: transparent;
}
.contentcell{
margin-top: 20px;
overflow: scroll;
height: 235px;
width: 500px;
overflow: scroll;
overflow-x: hidden;
overflow-y: inherit;
background-color: transparent;
}
#navbar{
padding-left: 10px;
padding-top: 0px;
width: 180px;
margin-left: 10px;
}
#navbar a:link, a:visited{
color:#CCCCCC;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
font-size: small;
}
#navbar a:hover{
background-color: #993300;
border: dashed thin #FF0000;
color: #CCCCCC;
}
#aboutnavbar a:link, a:visited{
color:#CCCCCC;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
text-align: center;
}
#aboutnavbar a:hover{
background-color: #993300;
border: dashed thin #FF0000;
color: #CCCCCC;
text-align: center;
}
#abouttext{
padding-top: 15px;
}
.abouttextcell{
height: 233px;
overflow: scroll;
overflow-x: hidden;
overflow-y: inherit;
padding-left: 15px;
}
.aboutpics{
height: 234px;
width: 124px;
border: #B4B4B4 medium solid;
}
- *{
- margin: 0;
- padding: 0;
- z-index: 1;
- }
- body{
- background-color:#000066;
- color: #CCCCCC;
- overflow: hidden;
- background-image: url(images/bgstripe.jpg);
- }
- a{
- color: #CCCCCC;
- }
- a:hover{
- color: #CC6633;
- }
- #horizon{
- position: absolute;
- top: 50%;
- width: 100%;
- height: 1px;
- overflow: visible;
- }
- #inset{
- width:800px;
- height: 200px;
- position: absolute;
- left: 50%;
- margin-left: -400px;
- top: -400px;
- overflow: visible;
- }
- #bgimage{
- overflow: visible;
- z-index: -1;
- width: 800px;
- height: 600px;
- }
- #imghorizon{
- position: absolute;
- top: 50%;
- width: 100%;
- height: 1px;
- overflow: visible;
- z-index: -2;
- }
- #container{
- width: 800px;
- height: 100%;
- padding-left: 30px;
- padding-top: 190px;
- margin-left: 0px;
- margin-top: 10%;
- }
- #content{
- padding-left: 10px;
- margin-top: 40px;
- width: 510px;
- height: 400px;
- margin-right: 30px;
- padding-top: 0px;
- font-family: Arial, Helvetica, sans-serif;
- background-color: transparent;
- }
- .contentcell{
- margin-top: 20px;
- overflow: scroll;
- height: 235px;
- width: 500px;
- overflow: scroll;
- overflow-x: hidden;
- overflow-y: inherit;
- background-color: transparent;
- }
- #navbar{
- padding-left: 10px;
- padding-top: 0px;
- width: 180px;
- margin-left: 10px;
- }
- #navbar a:link, a:visited{
- color:#CCCCCC;
- font-weight: bold;
- font-family: Arial, Helvetica, sans-serif;
- font-size: small;
- }
- #navbar a:hover{
- background-color: #993300;
- border: dashed thin #FF0000;
- color: #CCCCCC;
- }
- #aboutnavbar a:link, a:visited{
- color:#CCCCCC;
- font-family: Arial, Helvetica, sans-serif;
- font-size: 12px;
- text-align: center;
- }
- #aboutnavbar a:hover{
- background-color: #993300;
- border: dashed thin #FF0000;
- color: #CCCCCC;
- text-align: center;
- }
- #abouttext{
- padding-top: 15px;
- }
- .abouttextcell{
- height: 233px;
- overflow: scroll;
- overflow-x: hidden;
- overflow-y: inherit;
- padding-left: 15px;
- }
- .aboutpics{
- height: 234px;
- width: 124px;
- border: #B4B4B4 medium solid;
- }
any ideas?
here's a link so you can see on both browsers http://mindfullsilence.angelfire.com/#
Use your words like arrows to shoot toward your goal.
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
August 8th, 2008, 12:08 pm
- gonzoka
- Student


- Joined: Jul 30, 2005
- Posts: 75
- Loc: Bristol, UK
- Status: Offline
You can position elements center without using absolute - (more difficult to center vertically though, so I'm hoping you're not asking for that).
Use CSS such as:
and HTML such as:
I've added a height and border to the container div just so you can see where it is but those rules are not necessary.
Hope this helps - if you use this code you may find that you need to rewrite the code for the other aspects of the content in your site, but once its done you'll find it a lot easier to maintain and update.
Use CSS such as:
Code: [ Select ]
body { text-align:center; }
#container {
text-align:left;
width:800px;
margin:0 auto;
border:1px solid red;
height:200px; }
}
#container {
text-align:left;
width:800px;
margin:0 auto;
border:1px solid red;
height:200px; }
}
- body { text-align:center; }
- #container {
- text-align:left;
- width:800px;
- margin:0 auto;
- border:1px solid red;
- height:200px; }
- }
and HTML such as:
Code: [ Select ]
<body>
<div id="container">
<!-- All of your content here -->
</div>
</body>
<div id="container">
<!-- All of your content here -->
</div>
</body>
- <body>
- <div id="container">
- <!-- All of your content here -->
- </div>
- </body>
I've added a height and border to the container div just so you can see where it is but those rules are not necessary.
Hope this helps - if you use this code you may find that you need to rewrite the code for the other aspects of the content in your site, but once its done you'll find it a lot easier to maintain and update.
- mindfullsilence
- Professor


- Joined: Aug 04, 2008
- Posts: 846
- Status: Offline
thank you gonzoka, unfortunately I do need to center the container div vertically. Not to worry though, centering vertically was something I had already figured out. I needed everything inside the div which is centered vertically to render in the same spot on both browsers, I figured it out though, stupid mistake really. I set all divs inside the container div to absolute and now they're positioned where they should be in both browsers.
Use your words like arrows to shoot toward your goal.
Page 1 of 1
To Reply to this topic you need to LOGIN or REGISTER. It is free.
Post Information
- Total Posts in this topic: 3 posts
- Users browsing this forum: No registered users and 63 guests
- You cannot post new topics in this forum
- You cannot reply to topics in this forum
- You cannot edit your posts in this forum
- You cannot delete your posts in this forum
- You cannot post attachments in this forum
