Archive for the ‘CSS’ Category

Lessons in CSS

Hello! So i finally got around to reading over CSS and i learned about ids and classes.

So basically the difference between ids and classes is ids can only be used for a specific element and can only be used once. Classes can be used for more than one element.

For example this is an ID:
#sidebar
{ font: times new roman;
font-color: blue;
}

The (#) identifies the fact that its an ID. Once that ID has been used on an element, it cannot be used again.

Now a class on the other hand would look something like this:
.sidebar
{ font: times new roman;
font-color: blue;
}

The dot identifies the class. This can be used on multiple elements so i have come to the conclusion that it would be better to use the class for the general layout of the site and ids to define specific elements.

Now this is a learning process for me so if i have misunderstood something, please let me know.

Advertisements