CSS - Id

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

Use IDs to style the layout elements of a page that will only be needed once, and use classes to style text and such that may be declared multiple times.



<div id=”container”>
Your text or image.


CSS Code

#container { 
  width: 80%;
  margin: auto;
  padding: 20px;
  border: 1px solid #666;
  background: #ffffff;

Michael Bissigclasses, css, id, syntax