50 users online (1 members and 49 guests)  

Thread: Strict DTD


  Results 1 to 3 of 3

Related

  1. doctype "STRICT"    Forum: CGI Perl Forum
    Replies: 0
  2. 4.01 Transitional vs. 4.01 Strict    Forum: HTML Forum
    Replies: 3
  1. #1
    jakhall's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2004
    Location
    Sydney Australia
    Posts
    9

    Strict DTD

    G'day from Australia!
    I have written my first few webpages using html code (rather than 'font page'or similar) and I am trying to get them validated using the 'strict' form, but no matter what I do, I cant seem to get it passed.
    I can get them validated using the 'transitional' or 'loose' form but part of my assignment from Uni is to have at least 1 page validated using 'strict'.
    the message I am getting back from w3c is...

    Below are the results of attempting to parse this document with an SGML parser.

    Line 16, column 14: there is no attribute "BGCOLOR"

    <body bgcolor="#faf0e6">

    You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

    This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

    How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute.



    Line 17, column 9: there is no attribute "ALIGN"

    <p align="center"><font size=4>



    Line 17, column 29: there is no attribute "SIZE"

    <p align="center"><font size=4>



    Line 17, column 30: element "FONT" undefined

    <p align="center"><font size=4>

    You have used the element named above in your document, but the document type you are using does not define an element of that name. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Frameset" document type to get the "<frameset>" element), or by using vendor proprietary extensions such as "<spacer>" or "<marquee>" (this is usually fixed by using CSS to achieve the desired effect instead).


    I have tried to fix them, to no avail....
    HELP!!!

  2. #2
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732
    Hi there jakhall,

    and a warm welcome to these forums, cobber

    The reason that your document will not validate strict is that,
    you are using a deprecated element - font - and depecated
    attributes - bgcolor, center, align, and size.

    To achieve the desired presentation you must therefore use 'CSS'' ~ Cascading Style Sheets.

    You can get a good grounding in it at this site....

    http://www.w3schools.com/css/default.asp

    Here is an example of the 'css' that would have validated strict
    Code:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Strict XHTML Template</title>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
    
    <style type="text/css">
    /*<![CDATA[*/
     /*//]]>*/
    body {
         background:#faf0e6;
     }
    p {
         font:family:arial;
         font-size:18px;
         color:#000000;
         text-align:center;
     }
    a:hover {
         font-size:150%;
         color:#ff0000;
     }
    
    /*<![CDATA[*/
     /*//]]>*/
    </style>
    
    </head>
    <body>
      
    <p>
    This will validate now that the deprecated element ~ font ~ 
    and the<br /> 
    deprecated attributes ~bgcolor, center, align and size ~ have
    been replaced with 'css'. 
    </p>
    <p>
    If you are unfamiliar with 'css', you might find this site very
     helpful
    </p>
    <p>
    <a href="http://www.w3schools.com/css/default.asp">w3schools.com</a>
    </p>
    
    </body>
    </html>
    
    I hope that this will get you going again

    coothead
    Last edited by coothead; 06-19-2004 at 06:11 AM.

  3. #3
    jakhall's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2004
    Location
    Sydney Australia
    Posts
    9

    Fantastic Coothead...thanks.

    I had just started getting into css when I read your post and was also realising (through my research) that it is impossible to get 'strict' validation without using css.

    I think I am now on the right track, however...I just know I'll be back real soon!!!!!



Tags for this Thread