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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:41:11+00:00 2026-05-25T15:41:11+00:00

If you have a simple 2 layer list like so: <ul> <li><a href=’#’>Item 1</a></li>

  • 0

If you have a simple 2 layer list like so:

<ul>

    <li><a href='#'>Item 1</a></li>
    <li><a href='#'>Item 2</a></li>
    <li>
        <ul>
            <li><a href='#'>Sub-Item 1</a></li>
            <li><a href='#'>Sub-Item 2</a></li>
            <li><a href='#'>Sub-Item 3</a></li>
        </ul>
    </li>
    <li><a href='#'>Item 4</a></li>

</ul>

i currently have each 1st level li floating left and no widths have been defined (and i want to keep it that way). However if the text in a 2nd level li is longer than the 1st level li then the 1st level one will expand to the 2nd level.

How can i stop this expansion?
baring in mind the 2nd level items are block and NOT absolutely positioned.

  • 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-25T15:41:12+00:00Added an answer on May 25, 2026 at 3:41 pm

    By positioning your second level list absolutely you’ll take it out of the natural flow of the document.

    This will stop the first level li from expanding to accomodate the size of the second level ul

    ul li {
      position:relative;
    }
    ul li ul{
      position:absolute;
    }
    

    Working example

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

Sidebar

Related Questions

For sake of a simple example, I'd like to have a list of strings.
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
I have simple HTML code with some JavaScript. It looks like: <html> <head> <script
I have a TabActivity with a tab, which shows a list. I'd like to
I'm starting a new project which in simple terms will have a UI layer
I have created a simple repository class that is returning a list of Projects:
I have the following drawable set as a background: <?xml version=1.0 encoding=utf-8?> <layer-list xmlns:android=http://schemas.android.com/apk/res/android>
I have a simple object like this public class Test { public string Name
I have a simple class like this: class QuickReport { public string DeviceName {
I need to create some simple effects for the layers which I have created

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.