Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 569933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:20:52+00:00 2026-05-13T13:20:52+00:00

I am trying to identify all the <UL> that contain a menu list by

  • 0

I am trying to identify all the <UL> that contain a menu list by defining the ID like this:

<ul id="menutop">
    <li><a href="#">item1</a></li>
    <li><a href="#">item2</a></li>
    <li><a href="#">item3</a></li>
</ul>
<ul id="menumain">
    <li><a href="#">item1</a></li>
    <li><a href="#">item2</a></li>
    <li><a href="#">item3</a></li>
</ul>

As per what I understand, I could use:

ul[id|='menu']>li>a {color:#f00;}

(<a> direct child of a <li> direct child of an <ul> that has its id starting with menu)
But it doesn’t work.

Searching a bit brought me this [question][1] which suggests that ID is an attribute and not a property so I don’t get why it isn’t working. What am I doing wrong?

Here’s a link to the CSS2 Matching attributes and attribute values as per the W3 standards ( http://www.w3.org/TR/CSS2/selector.html#matching-attrs ).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:20:53+00:00Added an answer on May 13, 2026 at 1:20 pm

    According to the W3 documentation:

    [att|=val]
    Represents an element with the att attribute, its value either being exactly “val” or beginning with “val” immediately followed by “-” (U+002D)

    http://www.w3.org/TR/CSS2/selector.html#attribute-selectors

    This means ul[id|='menu'] is looking for <ul id="menu-somevalue"/> or <ul id="menu" />

    That’s likely why it isn’t working, because menutop and menumain don’t match.

    You could try renaming the IDs to menu-top and menu-main, or you could do:

    <ul id="menutop" class="menu">
        <li><a href="#">item1</a></li>
        <li><a href="#">item2</a></li>
        <li><a href="#">item3</a></li>
    </ul>
    <ul id="menumain" class="menu">
        <li><a href="#">item1</a></li>
        <li><a href="#">item2</a></li>
        <li><a href="#">item3</a></li>
    </ul>
    

    and your css:

    ul.menu li a {color: #f00;}
    

    This would give you coloring as needed on all menu ul’s, while still giving you the ability to have unique IDs for use with any scripting, etc. as needed.

    Also, as Pekka mentioned, the > selector isn’t widely supported so you may want to reconsider use of it for now…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to identify all the nodes in a tree that lead to
I'd like to identify all the include files of a particular file that I
I have a table that has redundant data and I'm trying to identify all
I am trying to identify SQL INSERTS that occur when a record is viewed
I'm trying to design an application that can identify COM objects and their properties
All, I am trying to identify plain text files with Mac line endings and,
Hallo all. I'm trying to map an association one-to-many to an entity that is
gtk.Builder is capable to identify all signals that a GUI (described in a XML
I'm trying to write a powershell script that creates an Exchange Mailbox. This works
I'm trying to identify which OSX application is currently active. I understand that in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.