CSS div id VS. div class

ids must be unique where as class can be applied to many things. In CSS, ids look like #elementID and class elements look like .someClass
 
In general, use id whenever you want to refer to a specific element and class when you have a number of things that are all alike. For instance, common id elements are things like header, footer, sidebar. Common class elements are things like highlight or external-link.

<html>
<head>
<style>
/* common to all text bars*/
.textdefault {
	background-color: #CCCCCC;
}

#text1 { /* for text bar 1*/
	border: 4px solid #0C9;
}

#text2 { /* for text bar 2*/
	border: 4px solid #F90;
}

#text3 { /* for text bar 3*/
	border: 4px solid #36F;
}
</style>
</head>
<body>
	<form action="#" method="get" name="form1" id="form1">
	
		<input type="text" class="textdefault" id="text1" value="first bar">
		<br /> 
		<input type="text" class="textdefault" id="text2" value="second bar"> 
		<br /> 
		<input type="text" class="textdefault" id="text3" value="third bar">
		
	</form>
</body>
</html>

Output