Foro de elhacker.net

Programación => Desarrollo Web => Mensaje iniciado por: SuXoR en 25 Noviembre 2010, 12:21 pm



Título: No consigo validar W3C xhtml estricto
Publicado por: SuXoR en 25 Noviembre 2010, 12:21 pm

El error que me da el validador es el siguiente:



Line 9, Column 87: document type does not allow element "link" here

… rel="stylesheet" type="text/css" href="style.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).



Mi ingles no es del todo malo pero no consigo saber que es lo que no esta bien ahi.

Se trata de un link a una hoja de estilos, luego creo que debe ir en el head, sospecho que se trata de un error de principiante pero no consigo "verlo".

Aqui posteo el codigo hasta el body a ver si alguno ve algo raro:

<!--declaración XML-->
<?xml version="1.0" encoding="UTF-8"?>
<!--declaración DTD-->
<!DOCTYPE html
   PUBLIC "-//W3C//DTD XHTML 1.0 Strict//ES"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--declaración nombre de espacio--> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
<!--cabezera-->
 <head>
  <title>
titulo
<!--link al css-->
   <link rel="stylesheet" type="text/css" href="syle.css" />
  </title>
 </head>
 <!--body-->
 <body>


Título: Re: No consigo validar W3C xhtml estricto
Publicado por: seele en 25 Noviembre 2010, 14:09 pm
hola
ests poniendo el link al css dentro de la etiqueta <title></title>
tiene que estar fuera del title pero dentro del head

saludos


Título: Re: No consigo validar W3C xhtml estricto
Publicado por: SuXoR en 26 Noviembre 2010, 01:21 am
Muchisimas gracias, justo era ese el problema.


Título: Re: No consigo validar W3C xhtml estricto
Publicado por: seele en 26 Noviembre 2010, 01:40 am
de nada! para eso estamos :)