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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:12:45+00:00 2026-05-25T00:12:45+00:00

I have a tricky problem to deal with. Here’s the scenario: I have an

  • 0

I have a tricky problem to deal with. Here’s the scenario:

I have an unordered list containing list items. These are displayed vertically, with backgrounds of alternating color, all of which have the same width (bounded by a fixed-width div a few parents up). On some of the items, there is a list item indicator (list-style-type: square; list-style-position: inside;), but on most of the items there is not. Within these list items there are three floated <div>s, all of which contain only text. One needs to align to the left, the other two to the right within the list item. The first and right-aligned <div> needs to have a fixed width, to prevent the contained text from flowing over onto the next line, or extending past the boundaries of the list item. The other two must also have fixed widths, since their content will not change size much at all besides font-specific browser rendering differences.

Here is a simple text example:

--------------------------------------
| • <Some Text>        <text2><text3>|
|   <Some more text>...<text2><text3>|
|   <other text>       <text2><text3>|
--------------------------------------

The text in the first item has this CSS: text-overflow: ellipsis; overflow: hidden; white-space: nowrap; to keep the overflow contained nicely. To view the whole content, I have some nice jQuery black magic to make it scroll which I have already tested and proved outside of this context.

My current problem is that in all major browsers, the floating of all the elements causes every list item to have no height, except for the ones with a list indicator (list-style-type). Adding a clearfix div to the end of the list item’s contents causes the content to be displayed at full width a line below the list item indicator:

--------------------------------------
| •                                  |
| <Some Text>        <text2><text3>  |
--------------------------------------

Everything would be very easy if the first text did not have to have a fixed width set to it (my layout already works like that), but as it is it must.

For your enjoyment, here is a valid HTML example illustrating exactly my problem:

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' lang='en' xml:lang='en'>
<head>

    <title>HTML List Problem</title>

    <style type="text/css">
        #container { width: 420px; }

        #container ul {
            list-style-type: none;
            margin: 0;
            padding: 0 20px;
            background: green;
        }

        .item { padding: 5px 0 4px 20px; }

        .item-current {
            list-style-type: square;
            list-style-position: inside;
        }

        .item-even { background: yellow; }
        .item-odd { background: orange; }

        .text1 {
            width: 200px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            float: left;
        }
        .text2, .text3 {
            float: right;
            width: 30px;
        }


    </style>

</head>

<body>

<div id="container">
    <ul>
        <li class="item item-current item-even">
            <div class="text1 item-current">
                Some Text
            </div>
            <div class="text2">
                text2
            </div>
            <div class="text3">
                text3
            </div>
        </li>
        <li class="item  item-odd">
            <div class="text1">
                Some Text
            </div>
            <div class="text2">
                text2
            </div>
            <div class="text3">
                text3
            </div>
        </li>
        <li class="item item-even">
            <div class="text1">
                Some Text
            </div>
            <div class="text2">
                text2
            </div>
            <div class="text3">
                text3
            </div>
        </li>
        <li class="item  item-odd">
            <div class="text1">
                Some Text
            </div>
            <div class="text2">
                text2
            </div>
            <div class="text3">
                text3
            </div>
        </li>
    </ul>
</div>

</body>
</html>
  • 1 1 Answer
  • 1 View
  • 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-25T00:12:46+00:00Added an answer on May 25, 2026 at 12:12 am

    The solution ended up being to use fixed widths for the sub-elements, and to structure the content slightly differently. Some things which should work just aren’t possible do pull off in HTML that way you’d think of doing it. Working in such a roundabout manner… It’s terrible.

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

Sidebar

Related Questions

Here's a tricky iPhone problem I've been working on. I have three UIScrollViews on
I've stuck with one quite tricky problem. I have list of products from different
I have some tricky generic type problem involving reflection. Here's the code. public @interface
I have a tricky problem that has had me scratching my head for a
I seem to have a tricky problem since the latest ADT update to release
I have a very tricky problem going on with content inside a textarea on
I have the following tricky problem: I have implemented a (rather complicated) class which
I have sort of a tricky problem I'm attempting to solve. First of all,
I have what I think is a tricky question, but hopefully someone on here
I have a tricky problem that I've been messing about with for a few

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.