/    Sign up×
Community /Pin to ProfileBookmark

Using the code:

[CODE]
<div id = “main” >
<div id = “menu” >
</div>
</div>
[/CODE]

I would like the menu position to be in relation to the outer div (main). How can I do this.

From css file

[CODE]
#main
{
margin:0px 0px; padding:0px;
text-align:center;
width: 800px;
height: 600px;
background-color: white;
}

#menu{
width: 250px;
height: 300px;
position:absolute;
top:0px;
left:90%;
background-color: purple;
}[/CODE]

I was under the impression that if the position is absolute it was in relation to its parent element??. But the menu is appearing 90% from the <body> and NOT the outer div.

Any help appreciated.

j

to post a comment
HTML

4 Comments(s)

Copy linkTweet thisAlerts:
@Daniel_TOct 12.2005 — Add [color=green]position: relative[/color] to [color=green]#main[/color]
Copy linkTweet thisAlerts:
@john_nobleauthorOct 12.2005 — Excellent.

Thanks for speedy response
Copy linkTweet thisAlerts:
@john_nobleauthorOct 12.2005 — Using the above CSS can anyone see why it only centers with IE. Netscape and Firefox remain left sided??

j
Copy linkTweet thisAlerts:
@Daniel_TOct 12.2005 — Set [color=green]margin: 0 auto[/color] on [color=green]#main[/color] ?
×

Success!

Help @john_noble 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 5.19,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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