Thank you kindly for your help! - Mary

---------- Forwarded message ----------
From: Mary Villanueva <[email protected]>
Date: Wed, Sep 14, 2011 at 5:53 PM
Subject: FW: [css-d] ID Selector Question
To: [email protected]




> -----Original Message-----
> From: [email protected] [mailto:[email protected]
> discuss.org] On Behalf Of Jukka K. Korpela
> Sent: Saturday, September 10, 2011 6:40 AM
> To: [email protected]
> Subject: Re: [css-d] ID Selector Question
>
> 10.9.2011 6:38, Mary Villanueva wrote:
>
> > What does it mean or do when one sets an ID selector to an HTML
> > element such as the one below?
>
> Setting an attribute like id="blueDropdowns" to an HTML element does not
> as such have any effect on rendering. In functionality, it means that the
> element can be a target of a link (that uses a URL ending with
> #blueDropdowns) and can be conveniently accessed in client-side
JavaScript;
> these things do not affect styling but they are often part of the reason
of
> using the attribute.
>
> > It seems to be acting as a class in this case
>
> No, it's not acting as a class, but an ID selector such as #blueDropdowns
can
> be used in many situations where a class selector would be another option.
> The difference is that ID selector matches (at
> most) one element in a document whereas a class selector may match many
> elements (and often does). The reason is that an id attribute value must
be
> unique within a document.
>
> > I want to understand this syntax so that I can be assured that I'm not
> > inadvertently building something that is going to fall apart in IE8
> > backwards.
>
> Id selectors as well as simple class selectors are as safe as you can get
- the
> selector types that have been supported by CSS-enabled browsers from the
> beginning.
>
> This, however, applies only when id and class attributes are used
correctly. If
> two or more elements in a document have the same id attribute value, all
> bets are off. Anything may happen.
>
> > I also have the other dropdown menus set to classes as shown in the
> > example below. I'm doing this because I need to be able to space the
> > elements precisely.
> > <ul id="blueDropdowns" class="About">
>
> So do you have id="blueDropdowns" on more than one element? Somehow
> I read between lines that this might be the case. Then you should use
class
> attributes and class selectors. Note that you can assign two classes to an
> element, e.g.
> class="blueDropdowns About"
> (which works well, ever since Netscape 4 stopped being an issue).
>
> (And do you use curly quotation marks in attribute specifications? The
> attribute class="About" is correct as per HTML5 but means that the
quotation
> marks are part of the attribute value!)
>
> > And here's the partial CSS for the dropdown menus. I hope it's enough
> > to help.
>
> People say that a URL says more than a thousand words, but that's really
an
> understatement. Here the main problem, if there is a problem, appears to
be
> in HTML markup, not in CSS code.
>
> --
> Yucca, http://www.cs.tut.fi/~jkorpela/
> __________________________________________________________
> ____________
> css-discuss [[email protected]] http://www.css-
> discuss.org/mailman/listinfo/css-d
> List wiki/FAQ -- http://css-discuss.incutio.com/ List policies --
http://css-
> discuss.org/policies.html
> Supported by evolt.org -- http://www.evolt.org/help_support_evolt/




-- 

Mary Villanueva
IT Instructor and Consultant
Byronsbyte Consulting
http:/www.byronsbyte.com/ced/photoshop
[email protected]
______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to