homepage Welcome to WebmasterWorld Guest from 54.161.246.212
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Doctype errors
Few questions
Echo_Tyme

10+ Year Member



 
Msg#: 8481 posted 10:37 pm on Aug 11, 2004 (gmt 0)

I've been tryign to get a Doctype on my site but they cause errors. I am trying html strict (as I was told would be a good choice) but alot goes wrong.

My site is made out of tables (for now) and it's all one big table with small tables inside, now I have a div align="Center" to center it in the page... but this makes all the text go to the center...

When I have no doctype it's fine, but when I put in a doctype it has this error. How could you fix that?

 

Krapulator

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 8481 posted 11:14 pm on Aug 11, 2004 (gmt 0)

Put this in your header (or external css file without the style tags)

<style>
td{
text-align: left;
}
</style>

tbeach

10+ Year Member



 
Msg#: 8481 posted 1:52 am on Aug 12, 2004 (gmt 0)

<div align="Center"> is not valid.
<div align="center"> is valid.
If you are going to validate 'strict'. You must lose the capital letters.

Echo_Tyme

10+ Year Member



 
Msg#: 8481 posted 2:11 am on Aug 12, 2004 (gmt 0)

i was thinking of the td left i will try that,

and now ALL letters in commands like font FF0000 will be ff0000? right?

hey the text-align did the trick! thankyou!

encyclo

WebmasterWorld Senior Member encyclo us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 8481 posted 1:33 pm on Aug 12, 2004 (gmt 0)

Echo_Tyme, there are few minor errors in the advice you've received that I think it is best to correct.

I am trying html strict (as I was told would be a good choice)

It is a good choice eventually, but your layout as you describe it sound much more suited to a Transitional doctype. The "Strict" version of HTML does not include various presentational elements of HTML which have been superceded by CSS. If you are attempting to validate an existing "tag soup" document, best to go for the easier Transitional first, then once everything validates, you can start to look at replacing some of your presentational HTML with CSS rules.

OK, here's the doctype I would strongly recommend to start with:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

If, and only if, the above doctype seriously breaks things, then you can use the following half-doctype:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

But only use the half-doctype until you have fixed the validation errors - after that, swap back to the long version and adjust the layout as required.

<div align="Center"> is not valid.
<div align="center"> is valid.
If you are going to validate 'strict'. You must lose the capital letters.

The capitalization matters when you use XHTML rather than HTML, not Strict rather than Transitional. In the long-term, it is best to use lower-case only in the tags, but it is not a priority.

and now ALL letters in commands like font FF0000 will be ff0000? right?

Don't bother changing the font tags yet - leave the colors with capitals. Once you can validate the page, one of the next steps is to remove all the font tags and replace them with much the simpler CSS rules.

<style>
td{
text-align: left;
}
</style>

The above should read:

<style type="text/css"> 
td {
text-align: left;
}
</style>

Once you've done that, put the page through the validator [validator.w3.org] and get your list of errors. Start from the top, and often you'll find that later errors are fixed when you correct the earlier ones.

Also, make sure you are defining the language of the document. On the opening <html> tag, make it <html lang="en"> (replace the "en" with the appropriate language code if you are not writing in English - "fr" for French, "de" for German, etc.)

Finally, make sure you define a character encoding for the page. The easiest way is with a meta tag. Try:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

If you are not using a western-European language, then you will need to replace ISO-8859-1 with a more appropriate charset.

Hope that helps a bit.

Echo_Tyme

10+ Year Member



 
Msg#: 8481 posted 11:17 pm on Aug 17, 2004 (gmt 0)

Thank you for your help, i had assistance from another user on here and got my index page to be HTML transitional valid (with the amount of other pages i'm not fixing those lol) But all of your advice helps but i have a few questions.

Why even have a doctype and "proper" code if it all shows up correctly, or do some browsers need this information inorder to work properly.

Also I see you all like to use CSS, where can I find a page with a list of all the available commands. I use minor ones such as the TD color and that, and the font and link colors, but what else is there?

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 8481 posted 10:59 pm on Aug 19, 2004 (gmt 0)

The reason to code it properly, and validate it as being correct, is to really know that it really is correct and that it will therefore probably display in a wider range of browsers than a site that wasn't validated but just quickly visually checked in one or two browsers.

You can control almost any visual aspect of an HTML element using CSS. The w3.org site has the full list (bit heavy reading though). Look for CSS 2 I think.

tbeach

10+ Year Member



 
Msg#: 8481 posted 3:06 pm on Aug 21, 2004 (gmt 0)

w3schools.com is a great place to learn, try, and obtain the information in a friendlier enviroment.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved