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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:13:59+00:00 2026-06-12T18:13:59+00:00

Bit of a strange one that I can’t seem to find a workable answer

  • 0

Bit of a strange one that I can’t seem to find a workable answer for; will probably be very simple!

I have some rogue li items which I’m using jquery to wrap in ul‘s and then position absolutely, but they are all in the same position (on top of each other).

What I need to do is use more jquery to increment each ul item like below:

<ul class="end"><li>Some text</li></ul> (top:30px;)
<ul class="end"><li>Some text</li></ul> (top:30px; - needs to be 60px)
<ul class="end"><li>Some text</li></ul> (top:30px; - needs to be 90px)

and so on and so forth. Now I would normally use css classes to do this but these items are generated dynamically and i don’t want lots of css classes as the amount could change/increase.

How would I make this work with jquery please (it’s not possible to use position:relative; or float in this instance)?

  • 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-12T18:14:01+00:00Added an answer on June 12, 2026 at 6:14 pm

    I suggest wrapping the entire group of ULs in a parent element (such as a div), giving the wrapper position:absolute, and giving the ULs themselves position:relative. This is the most robust and browser-compatible solution, and it’s the most common thing to do in this situation. I’ve done it myself, in fact.

    <div class="wrap">
        <ul class="end"><li>Some text</li></ul>
        <ul class="end"><li>Some text</li></ul>
        <ul class="end"><li>Some text</li></ul>
    </div>
    
    <style type="text/css">
        .wrap { position:absolute; top:30px; }
        .end { position:relative; }
    </style>
    

    If for some reason that doesn’t work for you, you could iterate through the ULs with jQuery:

    var currentHeight = 30;
    $('ul.end').each(function() {
        $(this).css('top', currentHeight);
        currentHeight += $(this).height();
    });
    

    Edit:

    Glad the above helped! Just for the record, jQuery can also pull elements out of the page flow and move them into your wrapper element. This should work even if they’re in amongst other elements.

    $('ul.end').each(function() { 
        $(this).appendTo('.wrap'); 
    });
    

    I’d probably do it this way.

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

Sidebar

Related Questions

I have a bit of a strange problem. I have a music app that
Bit of a strange one here, i have a CCTV system and contacted the
I have a bit of a strange problem with MySQL that I've never seen
This one may be a bit strange. I have a solution in Visual Studio
I realize this one is a bit strange, so I'll explain. For a simple
Bit of a strange one this. Please forgive the semi-pseudo code below. I have
So here is a bit of a strange one... I have a stored proc
I have a function that is supposed to find the last bit of a
I'm having facing problemind with LDAP, its bit strange one. My Web server is
I have a feeling my problem is a bit strange, but here goes... I

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.