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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:37:57+00:00 2026-05-28T02:37:57+00:00

I have a UL html list that looks like this: <div id=scroller> <ul> <li>item

  • 0

I have a UL html list that looks like this:

<div id="scroller">
            <ul>
                <li>item 1</li>
                <li>item 2</li>
                <li>item 3</li>
                <li>item 4</li>
            </ul>
</div>

and I have a css class called “selected”:

.selected {
    margin-left: 0px; 
    position: relative; 
    left: 0px;
}

When I set the class of the second item to “selected”, I expect the second element to push the first element out and move itself to the top of the screen but that doesn’t happen. Is there anything I need to add to the “selected” class to make that happen ? the width property for “li” is set to 50%.

Here is the sample code: http://jsfiddle.net/Lx6tw/

  • 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-28T02:37:58+00:00Added an answer on May 28, 2026 at 2:37 am

    Here’s what you CSS class does:

    .selected {
        margin-left: 0px;    //make left margin 0px
        position: relative;  //keep the element exactly where it was...
        left: 0px;           //EXCEPT move it 0px to the right
    }
    

    When I set the class of the second item to “selected”, I expect the
    second element to push the first element out and move itself to left
    of the screen but that doesn’t happen.

    To make the element ‘move itself to the left of the screen’ you can do this if you just want it moved over a certain amount:

    .selected {
        margin-left: 0px;    //make left margin 0px
        position: relative;  //keep the element exactly where it was...
        left: 50px;          //EXCEPT move it 50px to the right, AKA don't move it at all
    }
    

    I’m not exactly sure what you mean by ‘push the first element out’ as the position of an element that appears later in the document will not affect those that appear earlier unless you’re using CSS position on the first one. This might be what you’re looking for though:

    .item1 {           //give this class to the item you want pushed out (the first one)
        position: absolute;  //take it out of the document flow
        left: 50px;          //and put it 50px from the left edge of its containing element
    }
    

    However, its very difficult to tell if this is anything near what you actually want. Could you describe what you want in more detail, or perhaps link to a website that demonstrates the desired behavior? 😀

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

Sidebar

Related Questions

I have HTML that looks like this: <div class=item-list> <h3>Monday Sep 21</h3> <h3>Tuesday Sep
I have HTML that looks like this: <body class=style_0> <div> <div class=style_1>Pending Test List</div>
Consider we have a multi-level html list that looks like this: <ul class=catalog> <li>
I have a list that goes like this: <div class=item>1</div> <div class=item>2</div> <div class=item>3</div>
I have html that looks something like this: <div> <table> <tr onclick=show();> <td class=cell>Click
I have a list that looks like this -------------------- | | | | 1
I have a base.html template that contains a list of links. Example: <div id=sidebar1>
I am trying to create my own HTML element that looks like this: The
I have a webpage written in HTML. I have a dropdown list that is
I have an html ordered list with differnent types e.g <ol type=a> <li>This is

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.