Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

JonathanH

W3C validation - erro em tags

Recommended Posts

olhem esse código:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
	<title>Inicio - Republic Adventure server</title>
	<meta name = "Robots" content = "REPUBLIC ADVENTURE SERVER"/>
	<meta name = "Author" content = "Falcon - Jonathan Henrique"/>
	<meta http-equiv = "Content-type" content = "text/html;charset=UTF-8"/>
	<link href = "_estilos/base.css" rel = "stylesheet" type = "text/css"/>
	<link href = "_estilos/home.css" rel = "stylesheet" type = "text/css"/>
	<meta name = "description" content = "Republic Adventure server - Team Deathmatch. multi-language sa-mp server"/>
	<meta name = "keywords" content = "republic adventure server, tdm server, [Y]Falcon, falcon sa-mp, sa-mp war, sa-mp, gta online, republic, adventure, ucp"/>
</head>
<body>
	<div id = "logomarca"><div id = "logomarca_i"><img src = "_imagens/logotipo001.png" alt = "Republic Adventure server"/></div></div>
	<div id = "menu">
		<ul>
			<a href="?pagina=home"><li><p>Inicio</p></li></a>
			<a href = "#"><li><p>Fórum</p></li></a>
			<a href = "#"><li><p>UCP</p></li></a>
			<a href = "?pagina=linguagem"><li><p>Linguagem</p></li></a>
			<a href = "?pagina=equipe"><li><p>Nossa equipe</p></li></a>
			<a href = "?pagina=galeria"><li><p>Galeria</p></li></a>
			<a href = "?pagina=novidades"><li><p>Novidades</p></li></a>
			<a href = "?pagina=downloads"><li><p>Downloads</p></li></a>
			<a href = "?pagina=contato"><li><p>Contato</p></li></a>
		</ul>
	</div>
</body>
</html>

 

quando não tem o conteúdo dentro de <ul> é validado corretamente, mas quando é adicionado o <ul>, <a>, <li> retorna essa mensagem:

 

11 Errors, 1 warning(s)

 

Line 17, Column 26: document type does not allow element "a" here; assuming missing "li" start-tag

Line 17, Column 30: document type does not allow element "li" here

 

e repete por cada linha (item do menu) existente no arquivo.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Isso:

	<a href="?pagina=home"><li><p>Inicio</p></li></a>

 

deverá ficar assim:

	<li><a href="?pagina=home"><p>Inicio</p></a></li>

dentro da UL devera conter tags que pertencem ao seu grupo, para iniciar a listagem comece abrindo a tag <li>depois abrindo <a> depois o <p> e depois feche-as na mesma ordem que abril.

Abraços...

Compartilhar este post


Link para o post
Compartilhar em outros sites

O problema de se fazer isso é que para acessar o link do menu o clique deverá ser feito no <a>, o planejado é clicar dentro do <li> dando a impressão de um botão

Compartilhar este post


Link para o post
Compartilhar em outros sites

basta dar display: block; no a.

 

o html correto é como o @Gerciley disse. Nunca estrague o html por falta de conhecimento em css

Compartilhar este post


Link para o post
Compartilhar em outros sites

bem, fui tentando de outras formas até chegar chegar a resposta que eu estava adicionando um elemento de nível de bloco (como "<p>" ou "<table>") dentro de um elemento inline (como "<a>", "<span> ", ou" <font> ").

 

e com o toque final "display: block;" que só funcionou como eu queria dentro do <span> o código final ficou assim:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
	<title>iMaster teste</title>
	<link href = "teste.css" rel = "stylesheet" type = "text/css"/>
	<meta http-equiv = "Content-type" content = "text/html;charset=UTF-8"/>
</head>
<body>
	<div id = "menu">
		<a href = "#"><span>Lorem Ipsum</span></a>
		<a href = "#"><span>Lorem Ipsum</span></a>
		<a href = "#"><span>Lorem Ipsum</span></a>
		<a href = "#"><span>Lorem Ipsum</span></a>
		<a href = "#"><span>Lorem Ipsum</span></a>
		<a href = "#"><span>Lorem Ipsum</span></a>
		<a href = "#"><span>Lorem Ipsum</span></a>
		<a href = "#"><span>Lorem Ipsum</span></a>
		<a href = "#"><span>Lorem Ipsum</span></a>
	</div>
</body>
</html>
*
{
	margin: 0;
	padding: 0;
}

#menu
{
	width: 100%;
	height: 50px;
	background: orange;
	text-align: center;
	font-family: segoe UI;
	border-bottom: 2px solid #444;
}

#menu a
{
	float: left;
	height: 100%;
	width: 11.11%;
	color: #000000;
	text-decoration: none;
}

#menu span
{
	margin-top: 13px;
	display: block;
}

#menu a:hover
{
	color: orange;
	background: black;
	font-weight: bold;
}

 

poupei código em ambos arquivos :yes:

 

Tópico resolvido !!

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.