DOC TYPE errors - xhtml...

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

DOC TYPE errors - xhtml...

Post by simonmlewis »

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
We have that in the top of the template.
But the "XHTML" part of it is apparently too restrictive.

I am told that simple <!DOCTYPE html> will do, but if I do that, I get gaps around DIVs where before, there were no gaps.

Why would that be?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: DOC TYPE errors - xhtml...

Post by Celauran »

XHTML is somewhat dated and probably not appropriate. <!DOCTYPE html> is the HTML5 doctype and is probably what you want to be using. Hard to speculate on anything else without markup, styling, and possibly screenshots using each doctype.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: DOC TYPE errors - xhtml...

Post by simonmlewis »

Is there a slightly previous version of
<!DOCTYPE html>
That I can use? It might be that the style of CSS or coding, is not HTML5, and that could be why I am getting the gaps. (tho it would be odd to add a gap, where there is no gap in the code)
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: DOC TYPE errors - xhtml...

Post by Celauran »

https://www.w3.org/QA/2002/04/valid-dtd-list.html

You could fall back to HTML 4.

What issues are you encountering with XHTML?
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: DOC TYPE errors - xhtml...

Post by simonmlewis »

The main bizarre image is a set of divs with images inside. So I have tiled DIVs.
Within each Div is an image div with no width setting (so full width).
Inside is an image. For some reason, that image is not filling out the div, it's always having a 4 or 5 pixel gap at the bottom.
If I set the inner div to be 80%, it shrinks it down, but still there is that gap.

The CSS has no padding or margin inside that div. And if I click on the gap, there is something any padding/margin.

Take off the doctype and go back to the old one (before html 4!!), and the gap goes.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: DOC TYPE errors - xhtml...

Post by simonmlewis »

I just did this:

Code: Select all

img
{
 height: auto; /* Make sure images are scaled correctly. */
width: 100%; /* Adhere to container width. */
display:block;
}
And it worked. IT didn't stretch it, it just made the lower div move up as the image div was scaled.

Why would it even "not" scale it anyway??
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: DOC TYPE errors - xhtml...

Post by simonmlewis »

I've been reading up a lot about this.
Seems that Google preferrs it to be standard html5 now, and that 5 seems to want display: block if the image is in a DIV.

But it also warns about this:

[text]: Using the meta element to specify the document-wide default language is obsolete. Consider specifying the language on the root element instead.
From line 42, column 1; to line 42, column 54
S</title>↩<meta http-equiv="content-language" content="EN-GB" />↩<meta[/text]
Where do I put the language?
We want it there, because we have other sites in diff languages. Maybe it's not relevant at all, but if we want it where should it go?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: DOC TYPE errors - xhtml...

Post by Celauran »

The root elements means the html tag itself, so

Code: Select all

<!DOCTYPE html>
<html lang="en-GB">
  <head>
    .. etc
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: DOC TYPE errors - xhtml...

Post by simonmlewis »

What about the Utf-8?
If I use that it hates it and tells me to use Windows. How does it know what to use and where do I put it?
Trying to get errors I can control down to zero. For homepage at least.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: DOC TYPE errors - xhtml...

Post by Celauran »

Character set goes in a meta tag.

Code: Select all

<!DOCTYPE html>
<html lang="en-GB">
  <head>
    <meta charset="utf-8">
    ... other stuff
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: DOC TYPE errors - xhtml...

Post by Celauran »

User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: DOC TYPE errors - xhtml...

Post by Celauran »

simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: DOC TYPE errors - xhtml...

Post by simonmlewis »

Thanks. Will def look.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply