Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Dec 2006
    Posts
    306
    Thanks
    24
    Thanked 0 Times in 0 Posts

    errors massage from w3 validate

    Hi;
    I write a html, and it give me the following errors massage from W3 Validate.
    it make me comfuse with what it said i could not use the <br>. The following are my error massage and my code. Could you tell me how to fix it, please.

    //////////////////////////////////////////////////
    Error massages as following;

    # Error Line 38, column 0: character data is not allowed here .

    Type a Country Name for you:

    You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>) or forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes).


    # Error Line 39, column 3: document type does not allow element "BR" here; missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", "ADDRESS" start-tag .

    <br>

    The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

    One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").


    # Error Line 40, column 41: document type does not allow element "INPUT" here; missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", "ADDRESS" start-tag .

    <input type="text" name="CName" size="50">


    # Error Line 41, column 35: document type does not allow element "INPUT" here; missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", "ADDRESS" start-tag .

    <input type="submit" value="Submit">


    # Error Line 43, column 6: end tag for "FORM" which is not finished .

    </form>

    Most likely, You nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p>

    Another possibility is that you used an element which requires a child element that you did not include. Hence the parent element is "not finished", not complete. For instance, <head> generally requires a <title>, lists (ul, ol, dl) require list items (li, or dt, dd), and so on.



    /////////////////////////////////////////////////////////////////

    My code as following;


    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en"> 
    <head>
    <title>  Welcome to my page </title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
    html{
    margin: 0;
    padding: 0;
    }
    
    body { margin: 0;
               padding: 0;
    }
    #CCNameForm
    {
     width: 400px;
     height: 80px;
     color: #eee60f;
     background-color: #676fd3;
     margin: 10% 30% 40% 30%;
     font: normal bold 20px arial, Helvetica, sans-serif;
     border: 4px solid #1418d1;
     padding:2px;
    }
    
    form
    {
    margin: 0;
    padding:0;
    }
    </style>
    </head>
    <body>
    <div id="CCNameForm">
    <form name="CCNameForm" action="CCName2.php" method="post">
    Type a Country Name for you:
    <br>
    <input type="text" name="CName" size="50">
    <input type="submit" value="Submit">
    
    </form>
    </div>
    </body>
    </html>

  • #2
    Regular Coder Jutlander's Avatar
    Join Date
    Jun 2007
    Location
    In my own sick little world :P
    Posts
    425
    Thanks
    1
    Thanked 12 Times in 12 Posts
    This will pass validation:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en"> 
    <head>
    <title>  Welcome to my page </title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
    html{
    margin: 0;
    padding: 0;
    }
    
    body { margin: 0;
               padding: 0;
    }
    #CCNameForm
    {
     width: 400px;
     height: 80px;
     color: #eee60f;
     background-color: #676fd3;
     margin: 10% 30% 40% 30%;
     font: normal bold 20px arial, Helvetica, sans-serif;
     border: 4px solid #1418d1;
     padding:2px;
    }
    
    form
    {
    margin: 0;
    padding:0;
    }
    </style>
    </head>
    <body>
    
    <div id="CCNameForm">
    <form name="CCNameForm" action="CCName2.php" method="post">
    <div>
    Type a Country Name for you:<br>
    <input type="text" name="CName" size="50">
    <input type="submit" value="Submit">
    </div>
    
    </form>
    </div>
    
    </body>
    </html>
    It is because all input must be within a parent of some sort and also <br> tags (I believe it is under the strict doctypes, which this is)

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    The Netherlands, Baarn, Ut.
    Posts
    4,253
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Label

    Although a div will validate, the use of the label element would probably be more appropriate in this context.
    Regards,
    Ronald.
    ronaldvanderwijden.com

  • #4
    Regular Coder
    Join Date
    Dec 2006
    Posts
    306
    Thanks
    24
    Thanked 0 Times in 0 Posts
    Thanks Jutlander, it does work.

  • #5
    Regular Coder
    Join Date
    Dec 2006
    Posts
    306
    Thanks
    24
    Thanked 0 Times in 0 Posts
    Hi ronaldb66;
    Thanks for your advice.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •