Help - Search - Members - Calendar
Full Version: <link rel="stylesheet" href="style.css" id="">?
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
What does an id on a stylesheet do and how can it be done? I always thought stylesheets only gave elements ids but never had one as well. I guess that's not the case. unsure.gif
Darin McGrew
The class and id attributes are useful as selectors, so you can apply CSS rules only to some instances of an element (class), or only to a specific instance of an element (id).

See also CSS Structure and Rules in our CSS reference.
Almost all elements can have an ID. Maybe it's used for scripting purposes in this case?
Darin McGrew
Sorry, I just reread the question (or rather, I read the subject line and the question together). You aren't asking how id attributes are used in style sheets, but how they're used in link elements for style sheets.

In addition to any scripting-related reasons, it is possible to have alternative style sheets. The older examples show the title attribute used to distinguish among various alternative style sheets, but perhaps some are using id instead.
Alright, thanks happy.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.