PDA

View Full Version : Margin at the bottom...


WoocashPL
06-02-2003, 12:15 PM
Hi,

how can I force setting up a bottom margin under absolute positioned DIV?

I tried padding:10px and margin-bottom:10px an there's no result, bottom border of DIV is sticked to the browsers window border...

Here (http://www.republika.pl/woocashacn/blog.htm) is the page... validated in w3, sorry for the popup but it's not mine ;)

Spudhead
06-02-2003, 02:04 PM
Unless I'm getting confused, to get stuff away from the window edges, should you not be applying the margin settings to the body style, not the div?

MrDoubtFire
06-02-2003, 02:04 PM
After having tried to do this myself, I would suggest other alternatives, such as relatively positioning your DIV's and letting the flow of the page (with appropriate float/clear's) manage the layout.

However, I suspect you want what you want :p so here is a link I found that will help you immensely.

Link for footer/css positioning (http://www.thefixor.com/code_css_01.php)

I hope that helps, there are a lot of links that will help. However, again, I say to use something other than absolute positioning. After reading that css positioning was the cat's meow, I found that the cat was strangled and the dog was wearing it's skin ... It's good but not everything it was made out to be!

MrDF

WoocashPL
06-02-2003, 02:59 PM
Originally posted by Spudhead Unless I'm getting confused, to get stuff away from the window edges, should you not be applying the margin settings to the body style, not the div?

That's the point why I uploaded the code to the website -- I'm still learning CSS and every advise (about improving the code) will be valuable for me

So there's next question -- "margin" property -- applies to inside or outside of element? I suppose that it applies to outside, "padding" applies to inside...

If there is a better way to set up that layout -- I'd like to know it. I realy don't know when to use relative or absolte positioning...

cssangel
06-02-2003, 08:07 PM
Learning about positioning is possibly the first thing you should do when starting CSS.

Here's a good introduction (http://www.westciv.com/style_master/academy/positioning_tutorial/index.html)

learning about the the BOX Model (http://www.thenoodleincident.com/tutorials/box_lesson/index.html) and which properties affect the inside and outside (http://www.w3.org/TR/REC-CSS2/box.html#box-dimensions) of the "box" is also very important.

There are possibly better ways to achieve the same layout, but the thing to remeber is that when placing an element absolutely you are bringing it out of the HTML flow - so it not really there any more.

One solution that would "fix" your immediate problem is to declare a height on the body larger than your absolute div, not the best maybe but it works!

body {height: 850px;}

WoocashPL
06-02-2003, 08:47 PM
Originally posted by cssangel

One solution that would "fix" your immediate problem is to declare a height on the body larger than your absolute div, not the best maybe but it works!

body {height: 850px;}

that's quite tricky :D i never thought about (html) body height (!!!)

but it's not a flexible solution... my last idea was to stick little hidden DIV under the big one...

thnx for links -- i'm going to check them still today...