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 4565492
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:39:04+00:00 2026-05-21T18:39:04+00:00

It is a bit embarassing that I cant get my hear round the child

  • 0

It is a bit embarassing that I cant get my hear round the child selector.How do I target the parent list items in an items-list? I tried div#container > ul li{color: red;} but it changed the color of the entire item list,I was just looking to change the color of the parent items.

Say I want to specify a red color for all the parent list items and blue for all the child list items,how do i go about doing it?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
 div#container > ul li{  
   color: red;  

 }  
</style>
</head>

<body>
    <div id="container">  
        <ul>  
            <li> Parent List Item  
                <ul>  
                    <li> Child List Item  </li>  
                </ul>  
            </li>  
            <li> Parent List Item </li>  
            <li> Parent List Item </li>  
            <li> Parent List Item </li>  
        </ul>  
    </div>  
</body>
</html>

Thank You

  • 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-21T18:39:05+00:00Added an answer on May 21, 2026 at 6:39 pm

    I would do:

     div#container ul li{  
       color: red;  
     }
     div#container ul li ul li{  
       color: blue;  
     }
    

    or even better, assign a class to the ul:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
     ul.parentList li{  
       color: red;  
     }
     ul.childList li{  
       color: blue;  
     }
    </style>
    </head>
    
    <body>
        <div id="container">  
            <ul class='parentList'>  
                <li> Parent List Item  
                    <ul class='childList'>    
                        <li> Child List Item  </li>  
                    </ul>  
                </li>  
                <li> Parent List Item </li>  
                <li> Parent List Item </li>  
                <li> Parent List Item </li>  
            </ul>  
        </div>  
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Bit of a puzzle for you.... I have a 730px wide, auto height div.
Bit support question. Apologies for that. I have an application linked with GNU readline.
Bit of a strange problem here... I've got an update query that isn't working,
Bit of an odd one, I successfully implemented my own templated linked list as
Bit of an odd request. I have ~300 image URLs and 27 div s.
Bit of a problem here, basically I have a web address that I use
bit of noob question regarding .Net and C#. I have a function that registers
Bit of a basic question but I cant seem to find a straight answer
bit stuck on this, what I'm looking to do is loop a list of
Bit tricky to communicate but hope this makes sense. I have 8 div containers

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.