<body> og <center> problemer
Jeg er igang med at oprette en webside og jeg ønsker at den skal opfylde standarderne for XHTML. Når jeg får det valideret hos W3.org får jeg følgende fejlmeddelelser:Below are the results of checking this document for XML well-formedness and validity.
Line 27, column 14:
<body bgcolor=\"#ffffff\" topmargin=\"0\" marginheight=\"0\">
^
Error: there is no attribute \"bgcolor\" for this element (in this HTML version)
Line 27, column 34:
<body bgcolor=\"#ffffff\" topmargin=\"0\" marginheight=\"0\">
^
Error: there is no attribute \"topmargin\" for this element (in this HTML version)
Line 27, column 51:
<body bgcolor=\"#ffffff\" topmargin=\"0\" marginheight=\"0\">
^
Error: there is no attribute \"marginheight\" for this element (in this HTML version)
Line 29, column 7:
<center>
^
Error: element \"center\" not defined in this HTML version
Line 37, column 24:
<td class=\"top2\"><center><b>Side 1</b></center></td>
^
Error: element \"center\" not defined in this HTML version
Line 38, column 24:
<td class=\"top2\"><center><b>Side 2</b></center></td>
^
Error: element \"center\" not defined in this HTML version
Line 39, column 24:
<td class=\"top2\"><center><b>Side 3</b></center></td>
^
Error: element \"center\" not defined in this HTML version
Line 40, column 24:
<td class=\"top2\"><center><b>Side 4</b></center></td>
^
Error: element \"center\" not defined in this HTML version
--------------------------------------------------------------------------------
Sorry, this document does not validate as XHTML 1.0 Strict.
If you use CSS in your document, you should also check it for validity using the W3C CSS Validation Service.
--------------------------------------------------------------------------------
Source Listing
Below is the source input I used for this validation:
1: <?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
2: <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"DTD/xhtml1-strict.dtd\">
3: <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"da\">
4:
5: <head>
6:
7: <title>Sidens titel</title>
8:
9: <style type=\"text/css\">
10: td.top {background-color: #cccccc;
11: font-family: verdana, tahoma, arial;
12: font-size: 11;
13: height: 60px;
14: color: #ffffff; }
15: td.top2 {background-color: #999999;
16: font-family: verdana, tahoma, arial;
17: font-size: 11;
18: height: 17px;
19: color: #ffffff; }
20: td.space {background-color: #ffffff;
21: height: 2px; }
22: </style>
23:
24: </head>
25:
26:
27: <body bgcolor=\"#ffffff\" topmargin=\"0\" marginheight=\"0\">
28:
29: <center>
30:
31:
32: <table width=\"760\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\">
33: <tr>
34: <td class=\"top\" colspan=\"4\"><img src=\"blank.gif\" alt=\"\"></img></td>
35: </tr>
36: <tr>
37: <td class=\"top2\"><center><b>Side 1</b></center></td>
38: <td class=\"top2\"><center><b>Side 2</b></center></td>
39: <td class=\"top2\"><center><b>Side 3</b></center></td>
40: <td class=\"top2\"><center><b>Side 4</b></center></td>
41:
42: </tr>
43: </table>
44:
45:
46: </center>
47:
48:
49:
50:
51: </body>
52:
53:
54: </html>
Der er altså noget galt i mit <body>-tag. Hvordan får man endvidere centreret tekst i XHTML når man åbenbart ikke må bruge <center></center>?
På forhånd tak!
/pesa