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)

x86
Windows NT
defect

Tracking

()

RESOLVED WONTFIX

People

(Reporter: mnimbus, Assigned: buster)

References

Details

Attachments

(2 files)

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.
Moving to Kipp's bug list
Assignee: troy → kipp
Target Milestone: M16
mine! mine mine mine! all mine! whoo-hoo!
Assignee: kipp → buster
beta2 issue
Status: NEW → ASSIGNED
Target Milestone: M16 → M18
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 }".
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.
>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 }
Oops. The above style sheets will also set the right margin. Corrent rule is: margin: 1em 0 1em 40px;
Attached patch patch to the html.css (deleted) — Splinter Review
This may be a regression of bug 2038. CC'ing David for his comment.
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.)
redistributing bugs across future milestones, sorry for the spam
Target Milestone: M18 → M19
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
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...
*** Bug 209754 has been marked as a duplicate of this bug. ***
*** Bug 60241 has been marked as a duplicate of this bug. ***
*** Bug 240844 has been marked as a duplicate of this bug. ***
*** Bug 285589 has been marked as a duplicate of this bug. ***
*** Bug 128060 has been marked as a duplicate of this bug. ***
*** Bug 227937 has been marked as a duplicate of this bug. ***
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)
*** Bug 292010 has been marked as a duplicate of this bug. ***
*** Bug 297789 has been marked as a duplicate of this bug. ***
*** 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.

Attachment

General

Creator:
Created:
Updated:
Size: