you know when you're setting up your (global) styles for links (a hrefs), should you use 'class' or 'id', or does it matter?
| SitePoint Sponsor |

you know when you're setting up your (global) styles for links (a hrefs), should you use 'class' or 'id', or does it matter?
Use ID if the element is only going to be used once on the page. IDs are supposed to be unique. If the element is going to be used more than once, use a class instead.
Think back to school: Your name is Matt J. You're unique. When you have 20 other students in with you, you're in class.
Edit:
If you're going to set up styles for all links at once, just style the a tag rather than using classes or IDs. Example:
Code:a { font-weight: bold; color: #282828; text-decoration: underline; }

hmm I fancy your analogy..
so the use of an ID is really a crossover into programming territory because it is obviously used for any coding I take it, being unique and singular.
while you're there;
I've got a slightly older version of 'the dream' that likes to insert 'name' elements for form elements when I do rapid dev;
<input name="#" type="checkbox" value="#" checked="checked" title="glossary: Distributorship Terminology" />
does the name still stand (ie can you confirm that id hasn't replaced it)
the thing about the a I'll have to analyse more, I have in my design 4 link types:
those are my links. I need to also figure out say if I want to modify tooltip text for all glossary links to a different title, this isn't a style is it and would require some extra magic outside of css.
- Default Embedded instances: these instances do not have their own font style definition (adopts paragraph fomatting)
- Content Index instances (CI): these instances have their own font style definition
- Sidebar (Nav) instances (NV): these instances have their own font style definition
- Glossary Terms instances (GT): these instances have their own font style definition (I'm going to model Sitepoint and use a dashed underline effect for these)
Bookmarks