473,401 Members | 2,068 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,401 software developers and data experts.

A simple selector problem

Hi there,

I'm relatively new to CSS and having a difficult time with something that
should be simple. I've searched this group for answers to this problem, but
am afraid I haven't been able to find anything. It's probably just over my
head.

The problem is that I have a <li> which includes a nested <ul> with it's own
<li>'s. I want to select the original <li>, but can't seem to do it without
also selecting the nested <ul>'s <li>s. Here's the html/style
http://www.hamneggs.net/visionact/horiz_brief.html

Thanks so much for any advice,
Elizabeth

Nov 9 '05 #1
3 1278
On Wed, 09 Nov 2005 04:17:51 GMT, <yo********@earthlink.net> wrote:
Hi there,

I'm relatively new to CSS and having a difficult time with something that
should be simple. I've searched this group for answers to this problem, but
am afraid I haven't been able to find anything. It's probably just over my
head.

The problem is that I have a <li> which includes a nested <ul> with it's own
<li>'s. I want to select the original <li>, but can't seem to do it without
also selecting the nested <ul>'s <li>s. Here's the html/style
http://www.hamneggs.net/visionact/horiz_brief.html

You have "div#nav li.who a" which selects all <a> elements which are
descendants of li.who. You want the child selector: div#nav li.who > a

Actually I'd suggest using just: .who > a

Sadly however still not supported (AFAIK) by any of the myriad versions
of IE. So if you care about IE victims than you need to add an extra
class to your top-level <a> elements.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Nov 9 '05 #2
<yo********@earthlink.net> wrote:
The problem is that I have a <li> which includes a nested <ul> with it's own
<li>'s. I want to select the original <li>, but can't seem to do it without
also selecting the nested <ul>'s <li>s.


You'd need the child selector ">" for that which is not supported by IE.
To get around that you could specify a class for the <li>s you want to
target, or, depending on what you want to do, you may be able to use
multiple descendant selectors, for example like so:

ul li{color:green}
li li{color:black}

--
Spartanicus
Nov 9 '05 #3
Thanks so much. I did end up specifying a class for the <li> I was
targeting.

Elizabeth

"Spartanicus" <in*****@invalid.invalid> wrote in message
news:mf********************************@news.spart anicus.utvinternet.ie...
<yo********@earthlink.net> wrote:
The problem is that I have a <li> which includes a nested <ul> with it's own<li>'s. I want to select the original <li>, but can't seem to do it withoutalso selecting the nested <ul>'s <li>s.


You'd need the child selector ">" for that which is not supported by IE.
To get around that you could specify a class for the <li>s you want to
target, or, depending on what you want to do, you may be able to use
multiple descendant selectors, for example like so:

ul li{color:green}
li li{color:black}

--
Spartanicus

Nov 10 '05 #4

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

Similar topics

4
by: Zane | last post by:
Hi, I am having some grieve with the following part of my CSS, basically when using a composite selector using an ID as the first element the it doesn't display the expected results. Am I doing...
3
by: Lian Liming | last post by:
Hi, The language in my web site may be Simplified Chinese or English. I want to define different styles for each language. For each language, the http header is different. <meta name="language"...
25
by: Tim & Alethea Larson | last post by:
In order to mark links leaving my site, I recently added this rule to my stylesheet. A:after { content: "\2197" } The character is a northeast-pointing arrow, since that seems to be fairly...
1
by: John Rowe | last post by:
I run the web site for a University department. A few of my authors will carefully write: <h3>Title</h3> <p>Some text here.</p> <p>Second paragraph.</p> Most of us can't be bothered(!): ...
14
by: Melanie Avids | last post by:
Hi, I'm tired of banging my head on the computer. I'm hoping someone can help? I have a very small simple page that looks perfect in Firefox, Safari, and Netscape. It's clean. The HTML and CSS both...
5
by: Jim Garrison | last post by:
In reading someone else's stylesheet I ran across the following two selectors, in the following order. #footer .label { ... } #footer .label { ... } Are these not identical in effect? If...
11
by: samuelberthelot | last post by:
Hi, I've got 3 input HTML (dropdown lists) on my page. One for selecting a Month, one for the day, one for the year. Very simple... My problem is that I'd like to update the Days one according...
0
by: DBC User | last post by:
Hi, I have a datagridview, with column header and on the lefthandside the rowselector. I would like to do the following 2 1. When the user click ONLY the row selector or inside the gridview...
2
by: smachin1000 | last post by:
Hi All, In the sample schema & document below, I'd like the attribute "name" to be unique for all function elements under function_list. The tools I'm using (XML Spy and xmllint) all validate...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.