Visualizzazione dei risultati da 1 a 6 su 6
  1. #1

    Errori nella validazione del documento HTML

    Salve. Io ho fatto un semplice programma il quale deve importare, tramite i tag <base> e <link>, un foglio di stile css. Il programma deve restituire in output la scritta "Paragrafo in stile" con lo sfondo grigio. Quando lo mando in esecuzione funziona, ma quando vado a validare il documento su questo sito http://validator.w3.org/, mi dà degli errori e non so come correggerli. Cosa ho sbagliato nel programma? Grazie a tutti per l'aiuto

    Documento HTML:
    <!DOCTYPE HTML SYSTEM>
    <html>
    <head>
    <title>base1</title>
    <base href="file:///C:/xampp/htdocs/TSW/css/"/>
    <link REL="stylesheet" type="text/css" href="mioStile.css"/>
    <meta charset="utf-8">
    </head>
    <body>
    <p>Paragrafo con stile</p>
    </body>
    </html>



    Foglio di stile css:
    p {
    background-color: grey;
    color: white;
    }

  2. #2
    quali sono gli errori che ottieni?

    i tags e attributi vanno scritti in minuscolo e soprattutto l'href del tag base non può essere un documento presente su "c://" perchè questo drive non è online..
    Questa volta, più che un voto.. è favoreggiamento.

  3. #3
    Ho cambiato l'attributo REL e l'ho reso minuscolo. Per quanto riguarda l'href: se devo importare un file css che si trova sul computer, come devo fare? Gli errori che mi dà il validatore sono i seguenti:
    1. Line 6, Column 61: document type does not allow element "LINK" here <link rel="stylesheet" type="text/css" href="mioStile.css"/>
      The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

    2. Line 7, Column 17: there is no attribute "CHARSET" <meta charset="utf-8">
      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. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.

    3. Line 7, Column 24: required attribute "CONTENT" not specified <meta charset="utf-8">
      The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.

    4. Line 7, Column 24: document type does not allow element "META" here <meta charset="utf-8">
      The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

    5. Line 8, Column 8: end tag for element "HEAD" which is not open </head>
      The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.If this error occurred in a script section of your document, you should probably read this FAQ entry.

    6. Line 9, Column 7: document type does not allow element "BODY" here <body>
      The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

  4. #4
    Utente di HTML.it
    Registrato dal
    Feb 2014
    residenza
    Voltati
    Messaggi
    913
    Se il file css è su TUTTI i compuer che useranno la pagina nella STESSA POSIZIONE va bene così (comunque sconsigliato: il codice non è mantenibile e dipende da altre risorse).
    Non puoi mettere il css nella stessa directory del file html e richiamarlo solo con href="stile.css" ?
    No

  5. #5
    Scusa che vuoi dire che il codice non è mantenibile e dipende da altre risorse? Che dipende dal file css?

  6. #6
    Ragazzi grazie per il tempo che mi avete dedicato. Praticamente l'errore era sopra <!DOCTYPE HTML SYSTEM>, ho tolto il system e adesso non mi dà più errori. Forse come avevo scritto io lo validava con regole differenti, boh .

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.