Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

xjohn

macrumors regular
Original poster
Jan 6, 2003
108
1
Beijing
I'm just getting started publishing a web page, and am just starting out learning HTML.

I've been trying to get my web page to validate for HTML 4.01 Transitional, using the W3C validator, but there are a couple of errors that I can't figure out. I'm pretty sure I'm missing something silly.

If someone html-savvy would be willing to check out my page and tell me why the following two errors keep showing up in the validator, I would be very grateful (and I'm pretty sure my page would validate!).

1. "Line 6, column 68: character data is not allowed here
...ontent-type" content="text/html; charset=utf-8" />"

(I really can't figure this one out. It's right at the beginning of the header of my document.)

2. "Line 63, column 3: end tag for element "P" which is not open (explain...).
</p>"

(I've looked at the code many times, and I can't see why this error is showing up (repeatedly--for each entry of the weblog). I really think my elements are nested correctly!)

Anyway, it would be great if someone could point out where I'm going wrong here. I'd also appreciate any other feedback on the site. The layout's a bit sparse, and I'm not quite happy with it yet, so I'd appreciate any advice from design-savvy Macrumors members. ;)

Thanks,
John
 
1) In your page header your META tags are XHTML not HTML standard. To validate as HTML 4.01 Transitional you need to use <META ...></META> not <META .../>
 
hmmm... I fixed the meta tags like you suggested, and now they all show up as errors...

What am I missing?
 
Sorry - my mistake. in HTML 4.01 META tags do not have closing tags. i.e. you should have <META ...> not <META .../> or <META ...></META>
 
that did it!

That did it. Thanks again!

Now everything's validating except for the closing </p> tags...

Any ideas?

(I've gone from around 200 validation errors 12 hours ago to 12 now. It's just those p tags!!:))
 
Finally!

I got it to validate by replacing the <p> tag with a <br> tag. Probably should have thought of this a while ago.

I think the reason that it wouldn't validate before was that I'm not allowed to have a script element within a p element. Maybe?

Anyway... it's working now. Thanks for the help!!

John
 
<P> is used to mark the start of a paragraph. <BR> is used to specify a line return. Contrary to popular belief this is not the same. You should be able to start any tag you like (more or less) within a P tag. You should not need to put a script in a paragraph unless you are using document.write to do some dynamic stuff. In general all scripts should be loaded in the HEAD element with <SCRIPT src="..."></SCRIPT> as this enables the scripts to be cached between pages.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.