CSS IDs

Estimated reading: 1 minute 43 views

IDs are similar to
classes, except once a specific id has been declared it
cannot be used again within the same (X)HTML file.

				
					<div id="container">
 Everything within my document is inside this division.
 </div>
				
			
				
					#container{ 
width: 80%;
 margin: auto;
 padding: 20px;
 border: 1px solid #666;
 background: #ffffff;
 }
				
			

You will notice that the id selector begins with a (#) number sign instead
of a (.) period, as the class selector does.

Share this Doc

CSS IDs

Or copy link