473,394 Members | 1,811 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Position centered div on bottom of another div in IE

Hi,

I want to place a div centered of another div in IE. I get this to work
in Mozilla, but not in IE.

The code i use for mozilla is the following :

<html>
<head>
<style type="text/css">
#content {
position : absolute;
top : 100px;
bottom : 100px;
left:0px;
right:0px;
width:100%;
height:400px;
}
#banner {
position : absolute;
margin-left:auto;
margin-right:auto;
left: 0px;
right: 0px;
width : 150px;
height:60px;
bottom : 0px;
}
</style>
</head>

<body>
<div id="content">
<div id="banner">Content</div>
</div>
</body>
</html>
The code i use for IE is this :
<html>
<head>
<style type="text/css">
#content {
position : absolute;
top : 100px;
bottom : 100px;
left:0px;
right:0px;
width:100%;
height:400px;
text-align:center;
}
#banner {
text-align:left;
position:absolute;
width : 150px;
height:60px;
}
</style>
</head>

<body>
<div id="content">
<div id="banner">Content</div>
</div>
</body>
</html>

The problem is that banner div starts in the middle of the page. The
most left position is the center of the page. But i want it to be
centered in the div. If I leave out position:absolute it gets centered
but it's placed on top of the content div

Anyone got an idea how to solve this ?

--
DaWoE
Jul 20 '05 #1
7 10099
Els
DaWoE wrote:
Hi,

I want to place a div centered of another div in IE. I get
this to work in Mozilla, but not in IE.

The code i use for mozilla is the following :

<html>
<head>
<style type="text/css">
#content {
position : absolute;
top : 100px;
bottom : 100px;
left:0px;
right:0px;
width:100%;
height:400px;
}
#banner {
position : absolute;
margin-left:auto;
margin-right:auto;
left: 0px;
right: 0px;
width : 150px;
height:60px;
bottom : 0px;
}
</style>
</head>

<body>
<div id="content">
<div id="banner">Content</div>
</div>
</body>
</html>
The code i use for IE is this :
<html>
<head>
<style type="text/css">
#content {
position : absolute;
top : 100px;
bottom : 100px;
left:0px;
right:0px;
width:100%;
height:400px;
text-align:center;
}
#banner {
text-align:left;
position:absolute;
width : 150px;
height:60px;
}
</style>
</head>

<body>
<div id="content">
<div id="banner">Content</div>
</div>
</body>
</html>

The problem is that banner div starts in the middle of the
page. The most left position is the center of the page. But
i want it to be centered in the div. If I leave out
position:absolute it gets centered but it's placed on top
of the content div

Anyone got an idea how to solve this ?


Get rid of the position:absolute on the #content too. It puts
elements out of their normal order in the document.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 20 '05 #2
Els wrote:
DaWoE wrote:

Hi,

I want to place a div centered of another div in IE. I get
this to work in Mozilla, but not in IE.

The code i use for mozilla is the following :

<html>
<head>
<style type="text/css">
#content {
position : absolute;
top : 100px;
bottom : 100px;
left:0px;
right:0px;
width:100%;
height:400px;
}
#banner {
position : absolute;
margin-left:auto;
margin-right:auto;
left: 0px;
right: 0px;
width : 150px;
height:60px;
bottom : 0px;
}
</style>
</head>

<body>
<div id="content">
<div id="banner">Content</div>
</div>
</body>
</html>
The code i use for IE is this :
<html>
<head>
<style type="text/css">
#content {
position : absolute;
top : 100px;
bottom : 100px;
left:0px;
right:0px;
width:100%;
height:400px;
text-align:center;
}
#banner {
text-align:left;
position:absolute;
width : 150px;
height:60px;
}
</style>
</head>

<body>
<div id="content">
<div id="banner">Content</div>
</div>
</body>
</html>

The problem is that banner div starts in the middle of the
page. The most left position is the center of the page. But
i want it to be centered in the div. If I leave out
position:absolute it gets centered but it's placed on top
of the content div

Anyone got an idea how to solve this ?

Get rid of the position:absolute on the #content too. It puts
elements out of their normal order in the document.

It messes up my layout if I leave it out.

--
DaWoE
Jul 20 '05 #3
Els
DaWoE wrote:
Els wrote:
DaWoE wrote:

Hi,

I want to place a div centered of another div in IE. I get
this to work in Mozilla, but not in IE.

The code i use for mozilla is the following :

<html>
<head>
<style type="text/css">
#content {
position : absolute;
top : 100px;
bottom : 100px;
left:0px;
right:0px;
width:100%;
height:400px;
}
#banner {
position : absolute;
margin-left:auto;
margin-right:auto;
left: 0px;
right: 0px;
width : 150px;
height:60px;
bottom : 0px;
}
</style>
</head>

<body>
<div id="content">
<div id="banner">Content</div>
</div>
</body>
</html>
The code i use for IE is this :
<html>
<head>
<style type="text/css">
#content {
position : absolute;
top : 100px;
bottom : 100px;
left:0px;
right:0px;
width:100%;
height:400px;
text-align:center;
}
#banner {
text-align:left;
position:absolute;
width : 150px;
height:60px;
}
</style>
</head>

<body>
<div id="content">
<div id="banner">Content</div>
</div>
</body>
</html>

The problem is that banner div starts in the middle of the
page. The most left position is the center of the page.
But i want it to be centered in the div. If I leave out
position:absolute it gets centered but it's placed on top
of the content div

Anyone got an idea how to solve this ?

Get rid of the position:absolute on the #content too. It
puts elements out of their normal order in the document.


It messes up my layout if I leave it out.


What layout?
I can only see

<body>
<div id="content">
<div id="banner">Content</div>
</div>
</body>

I am quite sure that in the end, it's really the
position:absolute of your content that messes up the layout
the most.
Besides, it doesn't work in all browsers to use a
position:absolute with both top, left, bottom and right
values.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 20 '05 #4
On 15 Jul 2004 10:12:46 GMT Els <el*********@tiscali.nl> broke off
from drinking a cup of tea at LocusMeus.com to write:
I am quite sure that in the end, it's really the
position:absolute of your content that messes up the layout
the most.


Ar ha! Found you! hiding in one of these two groups. You really don't
like absolute positioning do you, Els?

I cant say I'm a great fan, it does seem to go wrong a lot!

Which leads me to the question, can complex layouts be achieved
without tables (spit) but just with relative CSS elements?

Matt

--
If your encyclopaedia doesn't list "widget glass", you're reading the wrong encyclopaedia.
The Probert Encyclopaedia. Its not the same.
http://www.probertencyclopaedia.com
Jul 20 '05 #5
Els
Matt Probert wrote:
On 15 Jul 2004 10:12:46 GMT Els <el*********@tiscali.nl>
broke off
from drinking a cup of tea at LocusMeus.com to write:
I am quite sure that in the end, it's really the
position:absolute of your content that messes up the layout
the most.
Ar ha! Found you! hiding in one of these two groups.


Which two groups? I read eh.. let's see...11 groups about
webdesign and html and stuff.
You
really don't like absolute positioning do you, Els?
I have no problem with it. My menu uses it too. It's just a
bit difficult to use the right way if you're just beginning
;-)

And in the case of the OP, setting position:absolute to the
container of the content, is not a good idea. The box won't
respond to its contents. Easy to see how that would be a
problem if one would get more contents or a larger font-size
or something.
I cant say I'm a great fan, it does seem to go wrong a lot!
Only if you use it for the wrong purpose.
Which leads me to the question, can complex layouts be
achieved without tables (spit) but just with relative CSS
elements?


Yes. And most of the time you don't even need
position:relative either. Just floats, but not too many. You
don't want to make IE hide your stuff when you're not looking
;-)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Chumbawamba - Homophobia
Jul 20 '05 #6
On 15 Jul 2004 13:07:11 GMT Els <el*********@tiscali.nl> broke off
from drinking a cup of tea at LocusMeus.com to write:
I have no problem with it. My menu uses it too. It's just a
bit difficult to use the right way if you're just beginning
;-)


Oh miaooow!

That was uncalled for, Els!

I think you're mistaking me for some one else.

Matt

--
If your encyclopaedia doesn't list "widget glass", you're reading the wrong encyclopaedia.
The Probert Encyclopaedia. Its not the same.
http://www.probertencyclopaedia.com
Jul 20 '05 #7
Els
Matt Probert wrote:
On 15 Jul 2004 13:07:11 GMT Els <el*********@tiscali.nl>
broke off from drinking a cup of tea at LocusMeus.com to
write:
I have no problem with it. My menu uses it too. It's just a
bit difficult to use the right way if you're just beginning
;-)


Oh miaooow!

That was uncalled for, Els!

I think you're mistaking me for some one else.


Not at all Matt, I wasn't referring to you, I just explained why
I advised the OP not to use it :-)
Somehow you must have applied an old saying about a fitting shoe
or something ;-)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: System of a Down - Aerials
Jul 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Nige | last post by:
I've just given one of my sites (www.wealdbroadband.co.uk) an overhaul. Anyone know if there is a way of fixing text at a certain relative position down a page? I'd like the "(c) 2003 ..." notice...
1
by: Falc2199 | last post by:
Hi all, I am using the "Poistion" attribute to correctly align a column of images that I have on a table. The code looks like so.... <TD valign="top" class="listinglight" align="left"> <A...
5
by: Haines Brown | last post by:
I want a centered body, 680px wide, having a red bottom margin. The following works well in galeon, but not in IE5, where the bottom margin steals the full width of the viewpoint. That is, the red...
8
by: Terry | last post by:
Trying my hand at table-less design. Looking for an XHTML 1.0 strict, CSS2 compliant solution. Here's the result I'm looking for: Div I: Some header text DIV II: Some text and a form which...
3
by: Markus Ernst | last post by:
Hello Reading the follwing document: http://www.w3.org/TR/WD-positioning-970131#In-flow it seems very clear that position:relative should be relative to the parent element. So in the following...
8
by: Edward | last post by:
I used to do this all the time in HTML-table layouting. How do I do this in CSS? -------------------------------------------------- <table width="400px"> <tr> <td bgcolor="beige">one line of...
4
by: john | last post by:
Hi to All, I am new to html authoring, so sorry if my terminology is not correct or exact. I would like to position a footer div to the bottom of the browser window. As I research in the web...
2
by: moondaddy | last post by:
Below is some xaml that is a mockup of a control I'm building. It's a shape that will be used in a diagramming tool. The red, blue and green rectangles simulate connectors on the side of the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.