2 Fehler in einfacher, erster html Datei.

engine

Captain
Registriert
Apr. 2007
Beiträge
3.956
Es steht wahrscheinlich alles da, nur ich erkenne die Fehler nicht.
Ich würde tippen, dass ich html, xhtml, css, frameset usw. mische.
Ich komme auch nach längerem Lesen einfach nicht dahinter, wie ich die genannten Begriffe richtig einordnen kann.
Ich würde mich freuen, wenn einer grobe Hinweise gibt, damit ich dann gezielter weiter lesen kann. Es ist einfach ein riesiges Gebiet und man wird von den Infos z.B. in Selfhtml regelrecht erschlagen. Man sucht einen Begriff und merkt, dass man ganz wo anders landet, weil alles interessant und wichtig ist....

Also, 2 Fehler sind bei der Überprüfung durch http://validator.w3.org vorhanden.
Die Website ist noch lange nicht fertig, daher nur so.
HTML:
Line 9, Column 51: document type does not allow element "BODY" here
<BODY style="background-image:url(bakgrnd2.jpg)">

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).


Error Line 35, Column 7: end tag for "HTML" which is not finished
</HTML>

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, in HTML the <head> element must contain a <title> child element, lists require appropriate list items (<ul> and <ol> require <li>; <dl> requires <dt> and <dd>), and so on.


HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
        "http://www.w3.org/TR/html4/frameset.dtd">
<HTML>
  
<HEAD>
  <TITLE>Überschrift 1</TITLE>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
</HEAD>

<BODY style="background-image:url(bakgrnd2.jpg)">
  <table border="0" cellpadding="10px" cellspacing="0" width="100%">
    <tr>
      <td align="center" width="650">
          <H1><FONT COLOR="Red">Überschrift 2</FONT></H1>
          <H4><FONT COLOR="Blue">Überschrift 3</FONT></H4>
          <APPLET
		    ...
          </APPLET> 
      </td>
      <td align="center">
	      <iframe src="datei.txt" frameborder="0" width="100%" height="660" name="name 1"></iframe>
      </td>		
    </tr>
  </table>
</BODY>

</HTML>
 
schon lange her, aber kommt das charset nicht über den head? (
Code:
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
)
 
Hm, steht doch da, wo das Problem liegt und was wahrscheinlich die Ursache ist.
Der erste Fehler kommt daher, dass du fehlerhafterweise ein style-Attribut im body-Tag angibst. Der hat da nichts zu suchen. Vermutlich resultiert daraus auch der zweite Fehler. Er interpretiert style wohl als Tag und findet keinen Endtag.
 
Das <Body> Tag erlaubt keine Attribute (zumindest nicht das Style Attribut). Lustigerweise steht auch genau das in der Fehlerbeschreibung des Checkers:
... This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section ...
 
Klar erlaubt body eine inline css definition. Das Problem hierbei liegt im angegebenen doctype. Bei einer gewöhnlichen HTML4 Website wäre das
Code:
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"    "http://www.w3.org/TR/html4/loose.dtd">
bei HTML 5 nur noch
Code:
<!doctype html>

Versuch es mal mit der HTML4 Variante, damit sollte es gehen.
 
Danke Tumbleweed
"This document was successfully checked as HTML 4.01 Transitional!"


Für <!doctype html> bei html 5 bekomme ich 12 Fehler und ein paar Warnungen.
 
Zuletzt bearbeitet:
Transitional-HTML ist obsolet. Ich empfehle dir, sauberes HTML5 zu schreiben, das keine Style-Informationen, sondern nur Semantik enthält. Alle Formatierungen werden von CSS übernommen. So erreichst du einen sauberen, gut strukturierten Code. Weitere Informationen findest du beispielsweise hier: Link
Altes HTML würde ich mir gar nicht erst angewöhnen.
 
genau, die Meldungen sind fast alle: "The font element is obsolete. Use CSS instead."

Ich muss am besten jetzt schon html5 nehmen.
 
Zurück
Oben