Closed Bug 400280 Opened 17 years ago Closed 17 years ago

when two divs are nested in another div, and the first one of them has an open-closed div inside, the next div is not positioned properly

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 162653

People

(Reporter: mdejong, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Opera/9.22 (Windows NT 5.1; U; nl)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6

I am sorry I cannot host a webpage displaying the problem but I post the HTML-code here:

<![CDATA[


The next div has two inside divs. They both have a margin-left of -100px. Both have empty content. 
<div style="margin-left: 200px; height: 300px; width: 300px; background-color: teal;">
	<div style="margin-left: -100px; height: 100px; width: 100px; background-color: pink;">
		&#160;
	</div>
	<div style="margin-left: -100px; height: 100px; width: 100px; border: 1px solid black;">
		&#160;
	</div>
</div>

The same divs are displayed here, again both with a margin-left of -100px. 
But now, one of the divs has an open-close div tag inside.
<div style="margin-left: 200px; height: 300px; width: 300px; background-color: teal;">
	<div style="margin-left: -100px; height: 100px; width: 100px; background-color: pink;">
		<div/>
	</div>
	<div style="margin-left: -100px; height: 100px; width: 100px; border: 1px solid black;">
		&#160;
	</div>
</div>


]]>

Reproducible: Always

Steps to Reproduce:
N/A. See details
Actual Results:  
position of the div gets messed up


I am not exactly sure if this is a bug or not.
I have tested this in Mozilla, Opera, IE, iCab and Camino, on Windows and Mac. 
They all give the same (but wrong?) output.
It seems like the second div refers to the first div as a parent when the <div/> is put somewhere inside that div.
If this is not a bug, I am really sorry for posting, but if so, can you explain to me why the code is rendered this way?
Thanks in advance
Most likely the document is sent with a content type of text/html, which means that <div/> is equivalent to <div>, since the HTML parser is used (not the XML one). See bug 162653 for details.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
Hello, 

Thank you for clarifying.
I have a content type of application/xml+xhtml, and I am using XHTML Strict. But I only tested on a local machine, so the content type is still text/html? 
My apologies for incorrect posting then.

Kind regards,

Martien de Jong

testcase sent as application/xhtml+xml
(In reply to comment #2)
> But I only tested on a local machine, so the content type is still text/html?

local machine means "file://" URL here?

You can check in the page info dialog which content type has been sent by the server (or detected for local files). As you can see in the attachment, this works fine if served with an XHTML content type.
Thanks a lot for the comments and explanations, 
and sorry for bothering you with my ignorance.
Glad to see it works server-side, so I don't have to adjust my code ;-)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: