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

The Archive Base Latest Questions

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

I have a div#content with many div.item inside it. When using :last-child to make

  • 0

I have a div#content with many div.item inside it.
When using :last-child to make the last div.item with no border-bottom, it’s OK.
But, as the content is dynamically appended using php and mysql results I’m using a conditional pagination table that will be appended after the last div.item which means at the bottom of the div#content. Here will be the problem as the CSS :last-child will not recognize the last div.item as the last-child.
my CSS looks like:

div#content div.item:last-child {
  border-bottom: none;
}

as you can see I’m defining that the last child id such a div.item

Any suggestions please. thanks in advance.

!!!!! Please note that the problem is not in the fact that the content is dynamic but in the fact that the CSS :last-child doesn’t recognize the div.item as the last child but the last element in the div#content despite telling the CSS that it’s:

div#content div.item:last-child
  • 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-17T17:04:40+00:00Added an answer on May 17, 2026 at 5:04 pm

    One possibility I can think of is that you’re appending elements that aren’t <div>s and/or don’t have the item class. Check the output of your PHP/MySQL script and see if there are any non-div.item elements beside (in DOM terms) the div.item elements.

    Such elements will not match the selector:

    div#content div.item:last-child
    

    That selector finds only <div>s with item class, that are the last child of div#content.

    Here’s an example.

    Before appending

    <div id="content">
      <div class="item"></div> <!-- [1] Selected -->
    </div>
    

    After appending

    <div id="content">
      <div class="item"></div> <!-- [2] Not selected -->
      <div></div>              <!-- [3] Not selected -->
    </div>
    

    What’s being selected, what’s not, and why?

    1. Selected
      This <div> element has the item class, and it’s the last child of div#content.

      It exactly matches the above selector.

    2. Not selected
      This <div> element has the item class, but is not the last child of div#content.

      It doesn’t exactly match the above selector; however, it can possibly match either one of these selectors:

      /* Any div.item inside div#content */
      div#content div.item
      
      /* The last div.item child of its parent only */
      div#content div.item:last-of-type
      
    3. Not selected
      Although this <div> element is the last child, it does not have the item class.

      It doesn’t exactly match the above selector; however, it can possibly match this:

      /* Any div that happens to be the last child of its parent */
      div#content div:last-child
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have many div in my aspx page. how to update the content of
I have a div which get's its content loaded through ajax .load(ajaxcontent.php). Inside this
I have many div's, when ever I any of the div, its content gets
I have a div with this content <h3>title list1</h3> <ul><li>element1</li> <li>element2</li>`</ul> repeated many times
I have a page with the following structure: div.wrapper > div.content > div.item +
suppose i have many div's in my page but i want to print the
I have a wrapper div and many content blocks. The content block can be
Let's say I have many of these in my content div : <cite class=fn>blabla</cite>
I have an Isotope #container div with many .item divs, which can be maximised
I have a content div that surrounds all my content, a navigation div and

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.