Closed Bug 289568 Opened 19 years ago Closed 19 years ago

Firefox doesn't seem to like XHTML (style="margin-left:200" doesn't work - amongst other things.

Categories

(Firefox :: General, defect)

x86
Windows 2000
defect
Not set
major

Tracking

()

VERIFIED INVALID

People

(Reporter: aallway, Assigned: bugzilla)

References

()

Details

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-GB; rv:1.7.6) Gecko/20050321 Firefox/1.0.2

I have created a simple strict xhtml document that demonstrates this problem - 
I've checked that this is valid using the w3c validator (and have included it's 
source at the end of these details). 

Initially I started with this source in a local file called "su.xhtml" and 
opened it using Firefox. When I do so the top paragraph should be indented by 
200 pixels (the paragraph has an attribute of style="margin-left:200;" ... it 
isn't (checked and works in IE by the way).

So then I renamed the file as "su.html" and the margin still did not work.

I then additionally removed the top two lines (the "<?xml ...." and the "<!
DOCTYPE ... " lines. 

Then the left margin was applied correctly by firefox.

As I said this is a simple test document I created because of a similar problem 
I was getting in a much more complex document. In the more complex document I 
was also getting various other problems, including the fact that Java script 
functions called from the onclick action of an image failed to be called if I 
pass the id of the img tag as a parameter to the function (again, this worked 
fine if the file extension was .html and I removed the <?xml and <!DOCTYPE 
lines from the top of the document).

It is possible that I've missed something in the header that firefox requires; 
not sure why but for some reason firefox understands the margin's an <img id's 
passing to java functions if the file is NOT xhtml but does not behave 
correctly if the file is properly declared as XHTML.

Anyway, hope someone can help before I lose any more hair :O)
Here's the source for my su.xhtml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Testcase for bug 277480</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-
8" />
	</head>
	<body>
		<p style="margin-left:200;">This text should have<br />a margin 
of 200 pixels!<br />
			<br />
		</p>
		
		<p>W3C Validate this XHTML file...</p>
		<p>
			<a href="http://validator.w3.org/check?uri=referer">
				<img src="http://www.w3.org/Icons/valid-
xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" />
			</a>
		</p>

	</body>
</html>








Reproducible: Always

Steps to Reproduce:
1.Save the xhtml from source to a local file called "su.xhtml"
2.Open this file in fire fox. The top paragraph should be indented by 200 
pixels... it isn't.
3.Change the file extension to .html and remove the top 2 lines (the <?xml and 
<!DOCTYPE lines) and load that into firefox - the top maragraph is indented 
correctly because the margin has been applied.


Actual Results:  
As described above.

Expected Results:  
As the original su.xhtml is valid (according to the w3c standards validator) I 
think that it should have rendered correctly without having to remove the <?xml 
and <!DOCTYPE declarations and changing the extension to html.
No you should specify a scale. Like in this case px.
When you use: margin-left: 200px; the testcase will work.
How silly do I feel now!!! Doh!! Very sorry, kinda new to HTML stuff and this 
should have been obvious.

Still getting a problem with passing the id of an <img> to a java script 
function like this...
    <img id="BUTTON_ID" onclick="CallJava(BUTTON_ID)" src="btn.gif" />

Javascript console shows an error:  "Error: BUTTON_ID is not defined".

This works in HTML but I'm guessing I have to specify the parameter differently.

I'm pretty sure I've probably missed something in the reems of info I've read 
lately so I'll go back and check.

Thanks for the help!



CSS values require a unit, see http://www.w3.org/TR/CSS21/syndata.html#values

Also, Bugzilla is not an HTML/Javascript "help" forum there are enough
lists/newsgroups/other forums around to help (there are also one or two channels
on Mozilla IRC that can help, for example #css)

Reso->Invalid for above reasons.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.