Comunidad de diseño web y desarrollo en internet online

cuanto tulizar div#algo y cuando solo utiliza solo #algo

Citar            
MensajeEscrito el 23 May 2007 11:46 pm
¿¿¿ cual es la diferencia o es lo mismo ???

Por kiltroconpulgas

96 de clabLevel



 

safari
Citar            
MensajeEscrito el 24 May 2007 12:50 am
(elemento)#identificador se refiere a que sólo el (elemento) obtendrá el estilo si tiene por id identificador.

Código :

h1#titulo{
    color:#f00;
}

<h1 id="titulo">Título en rojo</h1>
<h2 id="titulo">Al no ser h1, no hay título en rojo</h2>



Código :

#titulo{
    color:#f00;
}

<h1 id="titulo">Elemento en rojo</h1>
<h2 id="titulo">Elemento en rojo, sin importar el tag</h2>


no suelo utilizar mucho estos, pues finalmente a los elementos que hay que asignarles un id habría que hacerlos únicos, ya que tiende a confundir (como en el último ejemplo)

suerte

Por fael

BOFH

2443 de clabLevel

3 tutoriales
2 articulos

 

firefox
Citar            
MensajeEscrito el 24 May 2007 09:58 am
Creo que no tiene mucho sentido usar esa notación, elemento#identificador, porque si pones dos elementos con el mismo id, el documento no valida (al menos en xhtml).

Por ryuz

350 de clabLevel

2 tutoriales

 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.