473,385 Members | 1,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Multiple selectors

Hi,

Apologies in advance for a newbie question, but I'm trying to decipher
css stuff, I can't find a direct parallel in web tutorials, and I'm not
sure what to search on.

My problem is that I'm familiar with multiple selectors (and various
types of selectors) but what does it mean if they are arranged like
this? :

#tabbedbar.a1 div.tab ul li#a1,
#tabbedbar.a2 div.tab ul li#a2 {
border: none;
}

So the comma seperates the two selectors, but each one looks like quite
a mixture of classes and IDs to me? Seperated by spaces (or not, in
the case of "li#a1").

Can someone either explain, or point me towards a useful resource that
might help?

Thanks,

Tim

Dec 22 '05 #1
7 1562
Can someone either explain, or point me towards a useful resource that
might help?


Try to copy a rule and paste it here :
http://penguin.theopalgroup.com/cgi-...electoracle.py
Dec 22 '05 #2
Thank you very much - that's what I call service - quick and useful.

****
Selects any li element with an id attribute that equals a1 that is a
descendant of an ul element that is a descendant of a div element with
a class attribute that contains the word tab that is a descendant of
any element with an id attribute that equals tabbedbar and a class
attribute that contains the word a1
or
any li element with an id attribute that equals a2 that is a
descendant of an ul element that is a descendant of a div element with
a class attribute that contains the word tab that is a descendant of
any element with an id attribute that equals tabbedbar and a class
attribute that contains the word a2.
****
Now I just have to drink some coffee to speed my brain up a bit...

Dec 22 '05 #3
Biguana wrote:
[...]
My problem is that I'm familiar with multiple selectors (and various
types of selectors) but what does it mean if they are arranged like
this? :

#tabbedbar.a1 div.tab ul li#a1,
#tabbedbar.a2 div.tab ul li#a2 {
border: none;
}

So the comma seperates the two selectors, but each one looks like quite
a mixture of classes and IDs to me? Seperated by spaces (or not, in
the case of "li#a1").
The first applies to a (the, actually, since IDs must be unique within a
resource) list item having ID "a1" contained inside an unordered list
contained inside a div of class "tab" contained inside an element having
ID "tabbedbar" if that element is also assigned class "a1".

Can someone either explain, or point me towards a useful resource that
might help?


*The* reference: http://www.w3.org/TR/CSS2/selector.html
Dec 22 '05 #4
On 2005-12-22, Biguana <te******@yahoo.co.uk> wrote:
Hi,

Apologies in advance for a newbie question, but I'm trying to decipher
css stuff, I can't find a direct parallel in web tutorials, and I'm not
sure what to search on.

My problem is that I'm familiar with multiple selectors (and various
types of selectors) but what does it mean if they are arranged like
this? :

#tabbedbar.a1 div.tab ul li#a1,
#tabbedbar.a2 div.tab ul li#a2 {
border: none;
}
So the comma seperates the two selectors, but each one looks like quite
a mixture of classes and IDs to me? Seperated by spaces (or not, in
the case of "li#a1").


space means descended from
# means id ==
.. means class constains
, means or this rule

so a <li id="a1"> in an <ul> in <div class="tab"> in somethng class="a1" id="tabbedbar"

or the same with a2 instead of a1

Bye.
Jasen
Dec 23 '05 #5

"Phil" <ph**@blash.com> wrote in message
news:xd********************@giganews.com...
Can someone either explain, or point me towards a useful resource that
might help?


Try to copy a rule and paste it here :
http://penguin.theopalgroup.com/cgi-...electoracle.py


I canot understand the very poorly worded instructions on this page.
I had expected that it would explain each line of the rule.
Perhaps my expectation is wrong.
I inserted the following:-

..test {
text-align: right;
color: red;
margin: 1px 2px 3px 4px;
}

Can someone tell me what I am doing wrong?
Or explain the cryptic output.
TIA
Brian Tozer
Dec 24 '05 #6
Thu, 22 Dec 2005 15:23:56 +0100 from Phil <ph**@blash.com>:
Can someone either explain, or point me towards a useful resource that
might help?


Try to copy a rule and paste it here :
http://penguin.theopalgroup.com/cgi-...electoracle.py


There's a slightly different version of that page, with explanations,
at
http://gallery.theopalgroup.com/selectoracle/

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/200..._wont_help_you
Dec 25 '05 #7
Thanks to everyone who has helped here. My problem was that I wasn't
familiar with descendant selectors (I said I was a newbie). Once
Phil's link had given me the terminolology I had something to search
on, and have read through the following tutorial (which I found really
helpful, and more advanced that previous basic tutorials, although it
does start from the basics as well).

http://www.westciv.com/style_master/...ial/index.html

It's weird how you can use stuff for ages without having a "formal"
understanding of it...

Cheers,

Tim

Jan 5 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tony Benham | last post by:
I have been getting to grips with css recently (very slowly), and one area I have a problem is when to use class selectors or id selectors. Are there any guidelines when to use each type ? The key...
4
by: Andy Fish | last post by:
hi, I am using descendent selectors to format cells within a table according to the css class of the table. However, when using nested tables, it seems to pick up the outer matching rule rather...
1
by: Joe | last post by:
I have a table with a student id and course id. I would like to make both fields the primary key since a student can have multiple course ids but I do not want duplicate records. How would I go...
3
by: spolsky | last post by:
hi, it is possible to apply multiple styles as shown in the following example. <STYLE TYPE="text/css"><!-- BODY { background-color:salmon; } P { margin-left:20px; } .clsCode {...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.