2 replies [Last post]
n3s
Offline
newbie
SE US
Last seen: 2 years 41 weeks ago
SE US
Timezone: GMT-5
Joined: 2012-02-13
Posts: 2
Points: 3

I'm having a problem that I can't get figured out.

What I have is a div set to position:relative via CSS, that contains another div set to :absolute via CSS... and instead of orienting to its :relative parent, it is orienting to the absolute document.

I'm trying to use this div as a footer - its container is the body. There are some divs above it that are all correctly closed, etc.

textual representation would look like this:

-body-
-wrapper div
-some other divs
-close wrapper div

-div in question
-absolute div giving me a headache
-close div in question

I used this exact technique in the header to position fb/twitter/rss icons over the header image where I wanted them, and they behaved exactly as I expected. The same style used in a different container gives different results.

Any thoughts? I'm stumped. Something obvious I'm not checking maybe? The footer divs have no floats at all.

n3s
Offline
newbie
SE US
Last seen: 2 years 41 weeks ago
SE US
Timezone: GMT-5
Joined: 2012-02-13
Posts: 2
Points: 3

Fixed it.

I added a clear between the main content and the footer. I don't understand why that was necessary, mind you, but it works.

balajidesign
balajidesign's picture
Offline
Enthusiast
Last seen: 1 year 5 weeks ago
Timezone: GMT+5.5
Joined: 2012-01-31
Posts: 116
Points: 124

Hi, It is most for div :

Hi,

It is most for div : relative and inner div absolute. if you are not specify the clear property. the browser will treated as the other div are started as same line.

we can specify for the clear property as a inline or css class also.

The clear property specifies which sides of an element where other floating elements are not allowed.

<a href="http://www.w3schools.com/cssref/pr_class_clear.asp" rel="nofollow">http://www.w3schools.com/cssref/pr_class_clear.asp</a>