/    Sign up×
Community /Pin to ProfileBookmark

fitting absolute positioned divs

hi all…

trying to do a small tabbed nav without reloading stuff. it’s at:
[url]http://guey.el.net/k/tests/tabs.html[/url]

the thing is i can not figure out why the absoulte positioned divs within the ‘con’ one are not fitting in the outer ‘box’ one… it’s all in the source…

can somebody please take a look and explain…..

thanks…

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@WebJoelMay 28.2006 — hi all...

trying to do a small tabbed nav without reloading stuff. it's at:

http://guey.el.net/k/tests/tabs.html

the thing is i can not figure out why the absoulte positioned divs within the 'con' one are not fitting in the outer 'box' one... it's all in the source...

can somebody please take a look and explain.....

thanks...[/QUOTE]


Not sure what you're after, but this is a start...

[CODE]#con div {
position: relative;
display: block;
margin: 5px 0;
padding:5px;
/*float:left;*/
border: 1px dotted red;
}
[/CODE]


edit:changed "inline" to "block", added "padding:5px;"
Copy linkTweet thisAlerts:
@toshogauthorMay 28.2006 — position: relative;[/quote]cool... this seems to be desired..

whats the point of absolute positioning then?!

edit:changed "inline" to "block", added "padding:5px;"[/QUOTE]wasn't inline... but thanks...

thank you....
Copy linkTweet thisAlerts:
@WebJoelMay 28.2006 — cool... this seems to be desired..

whats the point of absolute positioning then?!

re:wasn't inline... but thanks...

Opps, -my-bad! *I* changed your "display:none': to "display:inline;" and it [I]worked[/I] and I posted the result, but then realized that it placed the border around every sentence... looked very ugly, therefore I edited [B]my [/B]post to [I]changed inline to block[/I]...

thank you....[/QUOTE]

"absolute" positioning... think of it as z-index:0, ... it is 'not on the page', but 'floating over it', invisible to the content on the page, which starts at z-index:1. (And before you ask, -yes, IE permits negative-numbered z-indexes, however, compliant browsers won't.)

I am not a big fan or user of absolsute positioned items. They ARE very useful, but used sparingly. ?

You can place an abs-positioned anything [I]inside[/I] of a relative-positioned DIV and make it work. But here, since you WANT the contents of the DIV to force-open the outer borders, you have to call this 'relative positioned', or else, it isn't even on the page...

Not explained too well, I realize. *sigh*
Copy linkTweet thisAlerts:
@JPnycMay 28.2006 — Absolute positioning does one thing you can't do any other way, it allows you to superimpose one element on top of another. I use it only when I have to for the precise reasons that Joel just laid out. When you use it there is no document flow.
×

Success!

Help @toshog spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...