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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:39:36+00:00 2026-06-15T23:39:36+00:00

I am having trouble getting :last-child to work in my situation. HTML: <div class=test>Some

  • 0

I am having trouble getting :last-child to work in my situation.

HTML:

<div class="test">Some content</div>
<div class="test">Some content</div>
<div class="test">Some content</div>
<div class="action">Some other content</div>

CSS:

div.topic {
    border-bottom: 1px solid black;
}

div.topic:last-child {
    border-bottom: none;
}

JSFiddle

The last div.test still has the border at the bottom.
​
The problem I think is that the border-bottom: none applies to the very last div which is div.action and not to the last div of class test.

How can I solve it?

  • 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-15T23:39:37+00:00Added an answer on June 15, 2026 at 11:39 pm

    You will have to update your markup in order to achieve desired result. Wrap your unknown items in a wrapper, eg:

    Working DEMO

    <div id="list">
     <div class="topic">Some content</div>
     <div class="topic">Some content</div>
     <div class="topic">Some content</div>
    </div>
    <div class="action">Some other content</div>​
    

    then use this CSS:

    #list .topic {
     border-bottom: 1px solid black;
    }
    
    #list .topic:last-child {
     border-bottom: none;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble getting the following setTimeouts to work: $('a').click(function(){ if( last )
I'm having trouble getting the CanExecute method of my command to work property. I've
I am having trouble getting my application to work correctly. I am trying to
I'm having trouble getting the Jquery Validation to work with the following rules. I
I'm having trouble getting a simple Hello World app to work using Flask, MongoDB,
I fear this is a very trivial question. But I'm having some trouble getting
I'm having trouble getting this to work. It validates the fields as expected, but
I'm having trouble getting HTML::Template 's <TMPL_IF> blocks to function -- it seems like
I'm having trouble getting the value of the last insert Id from doctrine. I
I'm having trouble getting the correct scope within prototype's Ajax.Request class. What I'm trying

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.