Print Page | Close Window

<DIV> Quession...

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Web Design Discussion
Forum Description: Discussion on web design and development subjects.
URL: https://forums.webwiz.net/forum_posts.asp?TID=10821
Printed Date: 28 March 2026 at 5:50am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: <DIV> Quession...
Posted By: Necronom
Subject: <DIV> Quession...
Date Posted: 10 June 2004 at 9:10pm

When working with <div> tags and z-index positioning, the page itself makes room for the positioned layer wherever it's supposed to be. So, if you're using a lot of absolute positioned layers, you'll wind up with a ton of empty space at the bottom of the page. Does anyone know a way around this?

(sorry if this sounds a little confusing)

TIA!

. necronom .




Replies:
Posted By: dpyers
Date Posted: 11 June 2004 at 12:13am

The div is a block element and all block elements have a built in padding and margins which varies by browser but can be overidden with css and even set to negative values.

Top and Bottom values for padding are cumulative. Top and Bottom values for margins are not.
In this example, them amount of space between the two div's is 10 ems as padding is cumulative

<div style="padding: 5em;">Div One</div>
<div style="padding: 5em;">Div Two</div>

In this example, the amount os space between the divs is 5 em as the top amd bottom margins overlap
<div style="margin: 5em;">Div One</div>
<div style="margin: 5em;">Div Two</div>

When specifying margins or padding (e.g. padding: 0 0 0 0; -

  1. If 1 value is used, all borders use it
  2. If 2 values are used, the first is the Top+Bottom, the second is Left+Right
  3. If 3 vaules are used, the first is the Top, the second Left+Right, and the third the bottom.
  4. If 4 values are used, they correspond to TRBL.

In your case, using absolute positioning, you may want to set the padding to 0 and just use the margins for positioning - e.g.

<div style="padding: 0; margin: T R B L">The Content</div>



-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: Necronom
Date Posted: 11 June 2004 at 10:23am
interesting. I will try it out.

Thank you!

btw, do you run a website at all? Because you've helped me out on a lot of stuff around here over time. =)

. necronom .


Posted By: dpyers
Date Posted: 11 June 2004 at 11:18am
I have a personal site, but it's more of a gateway for web mail than anything else. Mostly build sites for others.

-------------

Lead me not into temptation... I know the short cut, follow me.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net