Closed
Bug 27851
Opened 25 years ago
Closed 25 years ago
setting margin-left to 0 on a list (ul, ol) doesn't remove indentation (because it's padding-left)
Categories
(Core :: Layout, defect, P3)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: mnimbus, Assigned: buster)
References
Details
Attachments
(2 files)
(deleted),
text/html
|
Details | |
(deleted),
patch
|
Details | Diff | Splinter Review |
When I create a list in HTML I should be able to control the indention of the
list using the margin properties in a CSS StyleSheet. Mozilla does not appear
to apply the margin properties at all.
<ul style="margin-left: 0;">
<li>Element 1</li>
<li>Elemenet2</li>
</ul>
This HTML shoud display an unordered list where the bullets are up against the
left side of the page. In Mozilla, the list is still indented the default
ammount.
Incidentally, in IE5.0 this list would be displayed with the bullets 16px to
the left of the left edge of the page.. this is obviously not correct either.
I think the W3C recommendation for CSS has a good description how the
margins/border/padding/content should all work together at
http://www.w3.org/TR/REC-CSS2/box.html.
mine! mine mine mine! all mine! whoo-hoo!
Assignee: kipp → buster
beta2 issue
Status: NEW → ASSIGNED
Target Milestone: M16 → M18
Comment 4•25 years ago
|
||
This is a browser default style sheets problem.
Mozilla sets "ul,dir,menu { padding-left: 40px }" by default.
To solve this problem, assign "ul { padding: 0 }" explicitly.
I don't know why default style is not "ul,dir,menu { margin-left: 3em }".
Reporter | ||
Comment 5•25 years ago
|
||
Reporter | ||
Comment 6•25 years ago
|
||
That clears some things up, however Mozilla still does not display padding: 0
correctly. The bullet ends up to the left of the edge of the container and is
not rendered. With padding at zero, the bullet should be against the left border.
Comment 7•25 years ago
|
||
>The bullet ends up to the left of the edge of the container and is
>not rendered. With padding at zero, the bullet should be against the left
>border.
This is also a default style sheets problem.
Mozilla sets list-containers margin-left to 0 by default.
When we assign "padding: 0", marker will be drawn outside of viewport
since UL elements have neither padding nor margin.
If you assign "ul { margin: 0 }" explicitly, IE will not also render the bullet.
Mozilla (and IE) does a correct thing.
buster: I suggest changing html.css to:
ul, menu, dir {
display: block;
list-style-type: disc;
margin: 1em 40px;
counter-reset: -html-counter 0;
float-edge: margin-box;
}
ol {
display: block;
list-style-type: decimal;
margin: 1em 40px;
counter-reset: -html-counter 0;
float-edge: margin-box;
}
This will solve the problem.
CSS2 spec Appendix A also recommends the following style:
|OL, UL, DIR,
|MENU, DD { margin-left: 40px }
Comment 8•25 years ago
|
||
Oops. The above style sheets will also set the right margin.
Corrent rule is:
margin: 1em 0 1em 40px;
Comment 9•25 years ago
|
||
Comment 10•25 years ago
|
||
This may be a regression of bug 2038.
CC'ing David for his comment.
Comment 11•25 years ago
|
||
If 'list-style-position' is outside, then the bullet should be outside the
block.
See bug 2038 for why this *should* be padding rather than margin. Authors
shouldn't rely on it to be one or the other in the UA stylesheet. CSS suggests
margin, but that suggestion is, IMO, wrong (and it is just a suggestion). (And
the suggested UA stylesheet has a bunch of other errors...)
I think this bug should be WONTFIXed. (Does that surprise you? I filed bug
2038.)
Assignee | ||
Comment 12•25 years ago
|
||
redistributing bugs across future milestones, sorry for the spam
Target Milestone: M18 → M19
Assignee | ||
Comment 13•25 years ago
|
||
I have to go with the WONTFIX option here, as the path of least risk. Sorry, I
know you put a lot of thought into fixing this one. But since the spec is
ambiguous and since I rely heavily on dbaron for interpretation of the spec, I'm
going with his recommendation.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → WONTFIX
Comment 14•25 years ago
|
||
For the record, in this case it's less interpretation of the spec then what
makes sense, despite being silly.
I wouldn't object if you want to change it to margin in quirks.css...
Comment 15•22 years ago
|
||
*** Bug 209754 has been marked as a duplicate of this bug. ***
Comment 16•21 years ago
|
||
*** Bug 60241 has been marked as a duplicate of this bug. ***
Comment 17•21 years ago
|
||
*** Bug 240844 has been marked as a duplicate of this bug. ***
Comment 18•20 years ago
|
||
*** Bug 285589 has been marked as a duplicate of this bug. ***
Comment 19•20 years ago
|
||
*** Bug 128060 has been marked as a duplicate of this bug. ***
Comment 20•20 years ago
|
||
*** Bug 227937 has been marked as a duplicate of this bug. ***
Updated•20 years ago
|
Summary: Margin styles on Lists not handled correctly → setting margin-left to 0 on a list (ul, ol) doesn't remove indentation (because it's padding-left)
Comment 21•20 years ago
|
||
*** Bug 292010 has been marked as a duplicate of this bug. ***
Comment 22•20 years ago
|
||
*** Bug 297789 has been marked as a duplicate of this bug. ***
Comment 23•19 years ago
|
||
*** Bug 329313 has been marked as a duplicate of this bug. ***
You need to log in
before you can comment on or make changes to this bug.
Description
•