/    Sign up×
Community /Pin to ProfileBookmark

Firefox/Mozilla Margin Bug(?)

I’m not sure if this is a bug – I somehow think it is not since this problem does not occur in IE! ?

Regardless, my problem is this (please see my code listing below). I have an element (UL) inside of a DIV that has a set height assigned to ie (104px). When I attempt to put a [B]top margin[/B] of 40px (or any size for that matter), instead of shifting the UL element down the assigned amount, it instead shifts the entire parent/container element (DIV) down. This only occurs in Mozilla-based browsers and does not seem to affect IE.

Has anyone else found this problem? I found one way to “fix” it – if you assign a border to the DIV or give it a padding value it works the way it should, but there has to be a reason why this problem is happening in the first place.

[B]HTML[/B]

[CODE]
<div id=”header”>
<p id=”toolbar”>
<li><a href=”#” id=”tool-en-home” title=”Home”>Home</a></li>
<li><a href=”#” id=”tool-en-contact” title=”Contact Us”>Contact Us</a></li>
<li><a href=”#” id=”tool-en-sitemap” title=”Site Map”>Site Map</a></li>
<li><a href=”#” id=”tool-en-links” title=”Links”>Links</a></li>
<li><a href=”#” id=”tool-en-order” title=”Order”>Order</a></li>
<li><a href=”#” id=”tool-en-language” title=”Français”>Français</a></li>
<li><a href=”#” id=”tool-en-search” title=”Search”>Search</a></li>
</ul>
</div>
[/CODE]

[B]CSS:[/B]

[CODE]
#header { /* DIV element */
background-color: Darkorange;
height: 102px;
margin: 0;
padding: 0;
position: relative;
width: 100%;
}

#header #toolbar { /* UL element */
height: 23px;
list-style-type: none;
margin: 44px 0 0 408px;
overflow: hidden;
position: relative;
width: 100%:
}

[/CODE]

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@ray326Apr 07.2006 — I'm not sure if this is a bug - I somehow think it is not since this problem does not occur in IE! [/QUOTE]Yeah, right. ?
[code=html]
<div id="header">
<p id="toolbar">
<li><a href="#" id="tool-en-home" title="Home">Home</a></li>
[/code]

That's not valid HTML.
Copy linkTweet thisAlerts:
@toicontienApr 07.2006 — It's not valid HTML, and it's also not the source of your problem. :p The answer lies with [url=http://www.w3.org/TR/CSS21/box.html#collapsing-margins]collapsing vertical margins[/url].
Copy linkTweet thisAlerts:
@badg0003authorApr 07.2006 — Yeah, right. ?
[code=html]
<div id="header">
<p id="toolbar">
<li><a href="#" id="tool-en-home" title="Home">Home</a></li>
[/code]

That's not valid HTML.[/QUOTE]



LOL Whoops, thats not what I originally had - sorry, that was an unordered list initally (yah right, sure sure).

Thanks for the tip.
×

Success!

Help @badg0003 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.27,
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,
)...