For a demonstration, see
http://nelson.oit.unc.edu/~alanh/op7bug.html
I've already submitted this as a bug report, but I thought others
might be interested.
-alan
--
Alan Hoyle - al...@unc.edu - http://www.alanhoyle.com/
"I don't want the world, I just want your half." -TMBG
Get Horizontal, Play Ultimate.
> For a demonstration, see http://nelson.oit.unc.edu/~alanh/op7bug.html
>
> I've already submitted this as a bug report, but I thought others
> might be interested.
I think it's probably related to Opera's quirks mode doctype switch
tripping over the xml bit on the first line.
--
Paul McGarry
http://pmcg.blogspot.com/
> For a demonstration, see
> http://nelson.oit.unc.edu/~alanh/op7bug.html
from the page:
| <?xml version="1.0" encoding="iso-8859-1" ?>
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
| "http://www.w3.org/TR/REC-html401/loose.dtd">
Huh? Either write XHTML/XML or HTML 4.01.
Both at the same time doesn't make sense.
The rendering bug is because of the XML-stuff in the first line, wich
triggers quirks mode. It is a known bug.
Lutz-Peter
> from the page:
> | <?xml version="1.0" encoding="iso-8859-1" ?>
> | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> | "http://www.w3.org/TR/REC-html401/loose.dtd">
>
> Huh? Either write XHTML/XML or HTML 4.01.
> Both at the same time doesn't make sense.
What do you mean? It is valid XML and (almost, it's missing an alt tag)
html 4.01 transitional.
You specify an XML prolog, but then use an SGML Doctype.
If you want to use HTML, remove the XML prolog -- if you want to use XHTML,
change your Doctype to that.
That's what LP means here.
--
Jor | "Let him that would move
.-. | the world first move
.-. | himself." - Socrates
> What do you mean?
HTML 4 is SGML and XHTML is XML.
In general they are not compatible.
> It is valid XML and (almost, it's missing an alt tag)
> html 4.01 transitional.
Thats more or less coincidence.
<http://www.cs.tut.fi/~jkorpela/html/empty.html>
Lutz-Peter
If I remove the XML prolog it does render properly in Opera7 (see
http://nelson.oit.unc.edu/~alanh/op7bug-b.html), but validator.w3.org
complains as follows:
"I was not able to extract a character encoding labeling from any of
the valid sources for such information. Without encoding information
it is impossible to validate the document. The sources I tried are:
The HTTP Content-Type field.
The XML Declaration.
The HTML "META" element."
Does this mean I've discovered a bug in the validator? What should I
do instead of using the XML declaration at the top?
> Does this mean I've discovered a bug in the validator? What should I
> do instead of using the XML declaration at the top?
If you want to stick with HTML, not XHTML, you have to specify the server
to send correct HTTP Headers.
Since your server is Apache, you *might* be able to place a file named
.htaccess (nothing before the period) in your root directory, with the
following contents:
AddType 'text/html; charset=ISO-8859-1' htm html
If this is not working, your server admins have disallowed the behaviour,
and you should contact them.
A way to get past the validator is to add the following META tag to your
HTML's <head> section:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
As for the "bug" in Opera -- that is because HTML 4.01 Transitional and
earlier trigger Quirks Mode, in which a large number of MSIE bugs are
emulated.
By placing an XML prolog on an HTML DocType you are in effect specifying an
unknown DocType, which triggers Standards Mode.
If you want Opera to behave according to standards, just use HTML 4.01
Strict, or XHTML.
> If you want Opera to behave according to standards, just use HTML 4.01
> Strict, or XHTML.
I realize this may be slightly off-topic, but the whole problem was
precipitated by a rendering problem from my home page:
http://nelson.oit.unc.edu/~alanh/index.html
I've tried to convert this to XHTML, but there's a limitation that I
don't know how to get around. I have a couple of "float:left" images
on the page that only make sense in the context of their current
paragraph and I don't want off-topic stuff to appear to their right.
Is there a way I can do the equivalent of a <br clear="all"> in xhtml?
If not, how can I get around this?
http://nelson.oit.unc.edu/~alanh/index.x.html
validator.w3.org complains: "there is no attribute "clear" (explain...)."
> Is there a way I can do the equivalent of a <br clear="all"> in xhtml?
> If not, how can I get around this?
Use CSS:
{clear: none/left/right/both}
To use it with the images:
img {clear:both}
Thanks a bunch for your help, that worked perfectly.
More data:
I modified the headers on the following url:
http://nelson.oit.unc.edu/~alanh/op7bug-b.html
as follows:
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
So I'm not mixing XML and HTML (or am I). But, I still get the same rendering
bug.
So, what now? If I eliminate the XML header (see op7bug-c.html), it
does render properly.
Is the problem with the <!DOCTYPE> tag then? What should I use
instead? Something like the following?
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
If it's a problem with the <!DOCTYPE> tag, then there's a problem with
virtually all the pages on www.w3.org.
> I modified the headers on the following url:
> http://nelson.oit.unc.edu/~alanh/op7bug-b.html
>
> as follows:
>
> <?xml version="1.0" encoding="iso-8859-1" ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>
> So I'm not mixing XML and HTML (or am I). But, I still get the same
> rendering
> bug.
This is a very unfortunate bug in Opera 7 -- it follows the IE bug in
treating anything before the DocType as an excuse to go into Quirks Mode,
even legal XML statements like the prolog, or an xml-stylesheet reference.
You are right here, but Opera is wrong.
This will be changed for a future release... with some luck, it is already
in the patch now underway.
XHTML 1.1, and XHTML 1.0 served as text/xml, application/xml, or
appplication/xhtml+xml does not suffer from this, as the Doctype switch is
used by the SGML parser only.