XHTML Validation

He has: 688 posts

Joined: Feb 2001

I'm having some problems with validation and I can't figure out why it's so drastically different.

I had a page that validated HTML4 perfectly, and I put that little logo on there. I thought all of my coding should also be XHTML valid too ( instead of and so forth) so I changed the doc type and revalidated. But to my surprise it had over 80 errors.

http://www.amysussman.com/links.php (The logo still says HTML4 but you can still click it)

I don't know why XHTML has so many problems with my meta tags, but why is the rest of my code have so many errors. I thought there was very little difference between HTML4 and XHTML. Am I wrong? The validator picked apart EVERYTHING, from not liking to saying theirs no attributs for height, width, align, bgcolor, etc. It even has a problem with it's own validation logo code and says the capital letter T in the word This isn't allowed. Confused Can somebody tell me why something that is supposedly 98% the same come up with so many errors on everything?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

1. all lowercase tags
2. all tags must be closed e.g.
3. a number of attributes have been deprecated, such as those used to style the appearance of the content, they should be moved to a stylesheet
4. The end of a comment is --> not --!>
5. All attribute values must be enclosed in double quotes. e.g. not
6. The button for HTML markup validation is written in HTML markup, not XHTML markup.

He has: 688 posts

Joined: Feb 2001

Thanks. I cut many of them quickly.

Hmm. I never saw all that junk underneath my tag. I guess my server put that garbage there. I deleted that server-written stuff which took care of unquoted attributes and cut the errors by half.

I cleaned the end of comments (-->), and I can look into things that can be moved into CSS (although I don't know which ones in particular.

But those meta tags are still killing me. All attributes are in quotes and I added the trailing slashes... but it still hates them. And for some of them it says the attributes don't even exist. What's wrong with this tag?

Line 9, column 11: there is no attribute "name" (explain...).
  <META name="author" content="Mike Sussman">
'

But there are still some that have me totally puzzled. Here's some of them (other than the meta tags).

Line 18, column 14: there is no attribute "bgcolor" (explain...).
  <body bgcolor="#ffffff" text="#000000">
Line 18, column 29: there is no attribute "text" (explain...).
  <body bgcolor="#ffffff" text="#000000">
'
No attribute "bgcolor" or "text" or "align" etc.? Since when? I can put that in CSS but since when is that not allowed?

Line 24, column 12: there is no attribute "width" (explain...).
    <td width="760" height="67" style="background: #2B5884; background-image: url(/
Line 24, column 25: there is no attribute "height" (explain...).
    <td width="760" height="67" style="background: #2B5884; background-image: url(
'
Wait now, how can it be wrong to put a width and a height value to a tag? Aren't you always supposed to address table heights and widths

Confused

Thanks again.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Do look at the resources on the WebStandards site, they will ease your pain.

But to answer your questions specifically:

1. you have

He has: 688 posts

Joined: Feb 2001

Thanks. Regarding the table width and height, I've never heard the term "Presentational Layer" before. That link you posted was very informative but I didn't see any mention of table heights or widths. Since I can't see having that sort of information in a global external style sheet, do you mean to say that I should always define table heights and widths using an inline css? I get by with CSS but I'm no expert, so would it look like this?

<td style="width:400; height:200">text</td>'

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

More likely it would look like this:

whatever

And in the CSS:

#thistable td {
height: 400px;
width: 200px;
}

If you do need to do it inline, it would be:

text

Because you need to have the unit measures in there, CSS allows a lot more than HTML does.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

That said, you should do everything humanly possible NOT to have it inline, as that defeats the purpose.

Busy's picture

He has: 6,151 posts

Joined: May 2001

It's good you striving for XHTML standards and all, but think you should work to XHTML Trasnititional to start with, strict isn't the best thing to jump into if you haven't used a lot of CSS or done much strict handcoding.

Using Trans will allow you to get away with a lot more while still being tight on tidy coding, ie all tags must be closed, all lower case, all values quoted etc. another example is you can still use 99% of HTML tags or use CSS, or mix em up a bit, a far better way to learn while you code this way, allowing you to progress with the times as you learn whats needed - CSS

Using Strict you can't use a lot of 'normal' HTML, certain things aren't valid no matter what/how you do them and using a strict doc type without being strict code can/does cause problems in bigger pages/sites.

Good on ya for doing it, you'll have your ups and down but always go forward.

DU-Squid's picture

They have: 58 posts

Joined: Nov 2003

For the body just put this in the css part

body {
background-color: #FFFFFF;
color: #000000;
}

and then just make it

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Um, DUSquid, if you use your CSS, you don't need to put class=body in there at all, eh? Wink

DU-Squid's picture

They have: 58 posts

Joined: Nov 2003

Suzanne wrote: Um, DUSquid, if you use your CSS, you don't need to put class=body in there at all, eh? Wink

Sorry didn't know that you didn't have to define the body class when you use css.

Deafening-Urge.net - Great Hosting at affordable prices.

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

It's good that you are trying to follow web standards, but it doesn't seem you have an understanding of why they have been created, and the change of thinking required to design an XHTML/CSS site...It's not just a matter of converting HTML 4, it's a way of life! Laughing out loud

Please follow Suzanne's advice and read the recommendations!

One facet of this: XHTML/CSS is the separation of content from layout code, this has particular relevance to your site: What you have done - even if it validates - is meaningless. You have not properly seperated code and content using CSS. For example: bgcolor="#ffffff" in your tag is returning an error when validated. This should be defined through CSS. Also there is no need to use tables in designs anymore, tags are far better.

Well I hope this makes sense, and helps a little Smiling

a Padded Cell our articles site!

He has: 688 posts

Joined: Feb 2001

Thanks everybody. I've put fixing up that site on hold since it's just for family, but I'm still interested in learning more and doing things better (or even right Wink)

One sidebar question in particluar:

JeevesBond wrote: Also there is no need to use tables in designs anymore, tags are far better.

JeevesBond, not using tables in design wasn't even on my radar. Confused How do I construct layouts without them, and how would I do it with tags? I know that could end up being a long, lengthy lesson but can you give me a brief few-sentence overview and/or a link for more information on this?

Thanks Smiling

They have: 461 posts

Joined: Jul 2003

i forget where i found the complete deprecation list, but w3c schools has a html/xhtml list which are identicle and they note what's deprecated (supported in html 4.0 and some in xhtml 1.0 transitional/loose, but not in xhtml 1.0 strict and above)

most style things have been moved. cell spacing is the only one that hasn't been that i can think of. right now.i know the center tag itself, and the u and b tags have been deprecated too

POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Wow, I get to say it three times in one thread, whee! Check out the learning section at the Web Standards site linked earlier -- there are many wonderful, solid, helpful resources on moving to tableless layouts if you choose.

Table-based layouts are still possible and in some cases may be indicated as the better design decision, however many things can be done with divs that previously HAD to be done with tables. Smiling Happy learning!

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

I'm just saying that:

body {}

is the same as

.body {}

And the first is a clearer way to do it.

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

fifeclub... take a look at: http://www.csszengarden.com make sure you look at the code!

That's what got me started with XHTML/CSS - the first time I looked at that site I nearly creamed my pants with excitment (overexaggeration for comic effect) Laughing out loud

a Padded Cell our articles site!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.