First line of a XHTML 1.0 Strict document
Posted: Thu Aug 02, 2007 5:04 pm
Hi,
I usually define my HTML documents as XHTML 1.0 Strict. However, recently, for a project, I needed to style content images as having a padding of five pixels with a white background and a black border of 1 pixel. This worked fine in Firefox, but Internet Explorer did not show the padding. After some searching, I found out, that I had to put the doctype on the very first line of the document and it worked! However, now the W3 markup validator concludes that the document is invalid, because the XML header could not be found on the first row.
So, the first set up was (IE fails to display the padding surrounding the image and the document is valid):
And the current set up is (IE displays the padding, but the document is invalid according to the W3 markup validator):
How do I solve this? I read somewhere that the XML header is optional, so I could leave out that line, but is that a good practice?
Thanks in advance and kind regards,
Jeroen
I usually define my HTML documents as XHTML 1.0 Strict. However, recently, for a project, I needed to style content images as having a padding of five pixels with a white background and a black border of 1 pixel. This worked fine in Firefox, but Internet Explorer did not show the padding. After some searching, I found out, that I had to put the doctype on the very first line of the document and it worked! However, now the W3 markup validator concludes that the document is invalid, because the XML header could not be found on the first row.
So, the first set up was (IE fails to display the padding surrounding the image and the document is valid):
Code: Select all
<?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">Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?xml version="1.0" encoding="iso-8859-1"?>Thanks in advance and kind regards,
Jeroen