This link has been bookmarked by 49 people . It was first bookmarked on 09 Jul 2008, by Maggie Wolfe Riley.
-
16 Apr 12
-
03 Jan 12
-
27 Sep 11
-
21 May 11
-
18 Apr 11
-
04 Apr 11
-
17 Jan 11
-
01 Dec 10
-
16 Nov 10
-
27 Sep 10
Mark Blair"ID’s and Classes are “hooks”
We need ways to describe content in an HTML/XHTML document. The basic elements like <h1>, <p> and <ul> will often do the job, but our basic set of tags doesn’t cover every possible type of page element or layout choice. For this we need ID’s and Classes. For example <ul id=”nav”>, this will give us the chance to target this unordered list specifically, so that we may manipulate it uniquely to other unordered lists on our page. Or we might have a section on our page that has no relevant tag to signify it, for example a footer, where we might do something like this: <div id=”footer”>. Or perhaps we have boxes in our sidebar for keeping content over there separated in some way: <div class=”sidebar-box”>." -
22 Sep 10
-
ID’s have special browser functionality
Classes have no special abilities in the browser, but ID’s do have one very important trick up their sleeve. This is the “hash value” in the URL. If you have a URL like http://yourdomain.com#comments the browser will attempt to locate the element with an ID of “comments” and will automatically scroll the page to show that element. It is important to note here that the browser will scroll whatever element it needs to in order to show that element, so if you did something special like a scrollable DIV area within your regular body, that div will be scrolled too.
This is an important reason right here why having ID’s be absolutely unique is important. So your browser knows where to scroll
-
-
18 Aug 10
-
28 Jul 10
-
ID’s are unique
-
- Each element can have only one ID
- Each page can have only one element with that ID
-
- You can use the same class on multiple elements.
- You can use multiple classes on the same element.
-
-
20 Feb 10
-
12 Nov 09
-
21 Jul 09
-
28 Jun 09
-
25 Jun 09
-
13 Apr 09
-
05 Apr 09
-
09 Feb 09
Tohir SolomonsMicroformats are just specific class names
Think microformats are over your head? They aren’t! They are just regular markup that make use of standardized class names for the information they contain. -
01 Sep 08
-
21 Jul 08
-
14 Jul 08
-
11 Jul 08
-
10 Jul 08
-
09 Jul 08
-
Maggie Wolfe RileyWhat he doesn't mention is how ID's get higher priority over classes, but this is a good intro.
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.