ID vs CLASS en CSS. Por favor explique en detalle con el ejemplo
He oído que la ID es única y solo se puede usar una vez en una página, pero funciona bien cuando se usa varias veces en una página. Por favor, hágame saber el propósito de la identificación y cómo es exactamente diferente de las clases.
@ ARCHIVO HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<LINK href="special.css" rel="stylesheet" type="text/css">
<title>Untitled Document</title>
</head>
<body>
<div class="layout">
<div class="left_box">
<div id="color"></div>
</div>
<div class="right_box">
<div id="color"></div>
</div>
</div>
</body>
</html>
@ ARCHIVO CSS
@charset "utf-8";
/* CSS Document */
.layout {
width:600px;
height:600px;
background-color:#666;
margin:0 auto;
}
.left_box {
width:300px;
height:600px;
float:left;
}
.right_box {
width:300px;
height:600px;
float:right;
}
#color {
background-color:#CCC;
height:600px;
}