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

  • Home
  • SEARCH
  • 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 6928757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:13:49+00:00 2026-05-27T11:13:49+00:00

Here is my CSS: #nav-primary ul li:nth-child(1) a:after { } Works everywhere now (used

  • 0

Here is my CSS:

#nav-primary ul li:nth-child(1) a:after { }

Works everywhere now (used this on my website) except Internet Explorer 8…

Is there possibly a way to use nth-child in IE8?
This is the worst version of this browser… nothing works as it should and I can’t find a way to fix it.

@edit:
Simplified version of what I want to achieve: http://jsfiddle.net/LvvNL/. Its just a start. CSS will be more complicated so I need to be able to aim every one of this links. Hope adding classes to every link is not the only way

@edit2:
I’ve just noticed that

#nav-primary ul li:nth-child(1) a {
    border-top: 5px solid #144201;
}

IS actually working in IE8! But this:

#nav-primary ul li:nth-child(1) a:after {
    content: "Text";
    display: block;
    font-weight: normal;
    padding-top: 5px;
    font-size: 12px;
    color: #666;
}

is NOT working. So what is going on?

  • 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-27T11:13:50+00:00Added an answer on May 27, 2026 at 11:13 am

    You can (ab)use the adjacent sibling combinator (+) to achieve this with CSS that works in IE7/8.

    See: http://jsfiddle.net/thirtydot/LvvNL/64/

    /* equivalent to li:nth-child(1) */
    #nav-primary ul li:first-child a {
        border-top: 5px solid red;
    }
    /* equivalent to li:nth-child(2) */
    #nav-primary ul li:first-child + li a {
        border-top: 5px solid blue;
    }
    /* equivalent to li:nth-child(3) */
    #nav-primary ul li:first-child + li + li a {
        border-top: 5px solid green;
    }​
    

    You cannot emulate more complex variations of :nth-child() such as :nth-child(odd) or :nth-child(4n+3) with this method.

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

Sidebar

Related Questions

here is my code: $(a).live('click', function(){ history.pushState({}, '', this.href); popstate(this.href); $(#loadpage).css(display, block); return false;
I have been trying to build this nav for weeks now and something always
Please help me someone with this code. CSS Code #nav, #nav ul { width:1000px;
This is my first time coding a vertical nav menu on a website, I
I am trying to implement a pure CSS menu on hover. Everything works except
Here is my css for my map div: #map { position: fixed; top: 9.48em;
I need some advanced CSS help here. I have a login button and a
I'm trying to create a popup for which I am using jQuery's CSS function.Here's
here is the sample: http://jsfiddle.net/Zg55k/ How can I change css background image and color
I have a CSS mouseover slider fully functional here http://jsfiddle.net/gU4sw/13/ . When I add

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.