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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:15:09+00:00 2026-06-10T15:15:09+00:00

I have a list that is empty at first, and gets populated dynamically with

  • 0

I have a list that is empty at first, and gets populated dynamically with JavaScript. Now I want the list to have a border only when not empty, but :empty and parent selectors do not match.

In the html.erb file, the list is declared as this:

<ul id="cepage_list" />

It’s populated (adding lis) upon user input in a form above, that’s working fine.
Now I have this in the CSS:

ul#cepage_list
{
  list-style-type: none;
  margin: 0px;
  padding-left:0px;
  background-color: white;     
}
ul#cepage_list:parent
{
  border: 1px dotted blue;
}
ul#cepage_list:empty
{
  border: 1px dotted red;
}

Default style applies correctly, but the ones with pseudo-class selectors apply weirdly. Here’s the behavior:

  • on page load, red border applies, that’s ok
  • on adding li‘s, nothing (would expect the :parent selector applies)
  • on clearing the list ( .empty() with jQuery), OK.

But why is the :parent pseudo-class not recognized when there are child lis under the list?

(tested on Chrome and Firefox 14)

  • 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-06-10T15:15:11+00:00Added an answer on June 10, 2026 at 3:15 pm

    <ul> is not a self-closing tag. Change it to:

    <ul id="cepage_list"></ul>
    

    Also, :parent isn’t a real pseudo-class. Did you mean :not(:empty)?

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

Sidebar

Related Questions

I have a list that I want to loop through (for trimtemp in trim)
I have one list that I want to take a slice of, reverse that
I have a list that I want to put in a dictionary, for simplicity
i have three list that all of them are connected with jquery-ui sortable, first
As of right now, I have a ddl that I already have populated with
I have 2 lists: first is list that I need to work with and
I have a list that gets refreshed every 2 seconds via the Handler postDelayed()
I have a list that contains 10**7 lists in the format: big_list = [[1,
I have a list that looks like this: l1 = ['200:200', '90:728'] I have
I have a list that has two items: projects and groups. Projects can go

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.