Closed
Bug 37705
Opened 25 years ago
Closed 25 years ago
Trying to block-center using nested DIVs
Categories
(Core :: CSS Parsing and Computation, defect, P3)
Tracking
()
VERIFIED
INVALID
People
(Reporter: aaron, Assigned: pierre)
References
()
Details
Attachments
(2 files)
Hi,
I am using Mozilla M15 under Windows NT 4.0 to test my Web site, which is
currently only published locally.
What I am trying to do is block-center a paragraph of text,
meaning that the paragraph will be displayed in a box of a
fixed width, centered horizontally in the window. My idea
for this was to have a DIV that centered a section of the
text, and another DIV nested inside that to specify a
paragraph. The two DIV classes are specified in a CSS file
available to every page within the site. The resulting
paragraph should appear to float in the middle of the page.
I don't know whether this is actually supposed to work. The page renders
incorrectly in M15, creating a paragraph of the right width but flushing it left
instead of block-centering it. The page renders correctly in IE 5.01, although
I wouldn't trust it for some other things as far as I could throw it. However,
I couldn't find anything in the HTML 4.0 specs about how nested DIV blocks
should be rendered.
Is Mozilla intended to allow for nested DIVs?
Nested DIVs are allowed? But what are you using to center? The CSS text-align
property doesn't apply to blocks - only the line boxes inside them.
| Assignee | ||
Comment 2•25 years ago
|
||
Sorry Aaron, we can't second-guess your code. I'm going to close this bug as
Invalid but feel free to reopen it if you attach a testcase to it.
If you need some information about page design techniques using CSS, several
sites and books are available. If you need to work with absolutely positioned
blocks, I recommend you to download a recent daily build that implements the most
recent specifications on the matter.
Status: UNCONFIRMED → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
| Assignee | ||
Comment 4•25 years ago
|
||
To center a DIV with a specified width, you should use margin-left:auto and
margin-right:auto. See the comments from David Baron in bug 37083.
| Assignee | ||
Comment 5•25 years ago
|
||
| Assignee | ||
Comment 6•25 years ago
|
||
Note that "text-align:justify" doesn't work on the Mac (bug 36417) but the
testcase above should display fine on Windows and Unix.
You need to log in
before you can comment on or make changes to this bug.
Description
•