Log In · Register


Help Topic Rules and Requirements

For a list of all requirements and guidelines pertaining to posting a new Help topic, please click here.

This Month's Contests | Staff Member of the Month | Hosts Looking for Hostees | Hostees looking for Hosts | BigBookofResources

Submission Guidelines

Reply to this topicStart new topic
div id Vs. div class
post Sep 23 2010, 11:19 PM
Post #1

Sex, Blood, & RocknRoll

Group: People Staff
Posts: 5,305
Joined: Nov 2007
Member No: 596,480

When is it proper to use a id verses a class? and the other way around?

It's been ages since I have looked at any kind of code so help a n00b out?
post Sep 24 2010, 01:32 AM
Post #2

Senior Member

Group: Administrator
Posts: 2,647
Joined: Apr 2008
Member No: 639,265

IDs are supposed to be unique per-page. You use an ID to describe a unique element on the page; you use a class to describe items that are generic and non-unique.

Take the front page of a blog, for example: the header would probably be div#header, whereas each blog post may be encapsulated as the div.blog-post class, since there are several of them and it's a generic container.
post Sep 24 2010, 04:02 PM
Post #3


Group: Official Member
Posts: 8,283
Joined: Dec 2007
Member No: 602,927

I had no idea that there was actually a proper time to use an ID vs a class.

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: