Closed Bug 380986 Opened 17 years ago Closed 17 years ago

<form> auto-brakes <p>

Categories

(Core :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: Vadimulik, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3

<p align="center">
    Centered text
    <form>
        <input type="button" value="Not centered button ??!!">
    </form>
    not centered text ??!!
</p>



Reproducible: Always

Steps to Reproduce:
1.
2.
3.
The markup you provided is not up to spec for HTML4 or XHTML.  I assume however that you intended it to be HTML4 because it has an unclosed tag and no body/head/title/html tags or DOCTYPE declared.
In the HTML4 spec available at http://www.w3.org/TR/html4/ (the version I used was  the current latest revision: http://www.w3.org/TR/1999/REC-html401-19991224) there are several components which taken together render your markup invalid HTML4 so Gecko closed the <p> tag when it could no longer be open.  To see the exact markup for the DOM that Gecko used, visit the page with markup from comment 0, hit ctrl-A or cmd-A on Mac, then right click the page background or text and select "View Selection Source".

"Generally, inline elements may contain only data and other inline elements."
<http://www.w3.org/TR/html4/struct/global.html#block-inline>

The 'p' element section lists <p> as an inline element in the first line of the DTD snippet and states "The P element represents a paragraph. It cannot contain block-level elements (including P itself)."
<http://www.w3.org/TR/html4/struct/text.html#edef-P>

The 'form' element section lists <form> as a block level element in the first line of the DTD snippet.
<http://www.w3.org/TR/html4/interact/forms.html#edef-FORM>

The behavior exhibited here is intentional and up to spec.  You should probably be using a DIV element instead here.

See also the HTML validator at http://validator.w3.org/
Here is the result of validating your markup through that website: http://tinyurl.com/yqdc62
Product: Firefox → Core
QA Contact: general → general
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.