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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:06:08+00:00 2026-05-24T19:06:08+00:00

We have a simple ul <ul> <li>some text</li> <li>some some text</li> <li>text more</li> <li>text

  • 0

We have a simple ul

<ul>
   <li>some text</li>
   <li>some some text</li>
   <li>text more</li>
   <li>text here</li>
</ul>

ul { text-align: center; width: 100px; }
li { width: auto; display: inline; }

So the ul can have several lines. How do I take last li of the each line inside ul?

  • 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-24T19:06:09+00:00Added an answer on May 24, 2026 at 7:06 pm

    If by last li on the each line of the ul you mean the last li in each ul, then:

    $('ul li:last-child');
    

    However, if you mean that you have your li‘s within the same ul written up on several lines in your source code, and you now want to get the last one on each line, then the answer is that you can’t. The DOM does not care about your newline characters in your code.


    Note: the correct way to do this would be to give those li‘s a separate class.

    <ul>
        <li></li><li></li><li class="last"></li>
        <li></li><li></li><li class="last"></li>
        <li></li><li></li><li class="last"></li>
    </ul>
    

    Now you can use CSS

    li.last { color: #444 }
    

    and jQuery

    $('li.last');
    

    the proper way…

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

Sidebar

Related Questions

Pretty simple question. I have a few ASP RequiredFieldValdators checking some text boxes. Out
I have HTML + CSS text. I need some lib with simple function like
I have seen several methods for creating simple fixed width single column layout using
I have some simple markup: <table> <tr> <td>Menu Item</td> </tr> </table> <div> <table> <tr>
Let's say I have some simple data y = [[datetime.datetime( 2012,1,1,1,1), 2.1], [datetime.datetime( 2012,1,1,1,2),
I have created some simple charts (of type FastLine) with MSChart and update them
I have simple HTML code with some JavaScript. It looks like: <html> <head> <script
Say you have a simple class with some storage data structure (list, vector, queue,
I have some very simple XML: <properties> <property> <name>BobFish</name> <explaination>Bob is a fish.</explaination> </property>
I have some VERY simple code to return the title for a section header:

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.