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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:01:23+00:00 2026-05-14T03:01:23+00:00

(The target browser is IE8) I have a div that contains a list of

  • 0

(The target browser is IE8)

I have a div that contains a list of elements floated left. The elements width can change at runtime. I’d like to make it so that if they longer fit in the div it just gets cut off and doesn’t wrap to a new line.

It only seems to work if the item is on a line by itself:

This page demonstrates the problem:
(The text input’s width needs to change at runtime)

<!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" >
<head>
    <title></title>
    <style type="text/css">
        div.aclb {background:#EEF3FA; color:#666; cursor:text; padding:1px; overflow-y:auto; border:#BBC8D9 1px solid; }
        div.aclb:hover {border:#3399FF 1px solid;}
        div.aclb.focus {background:#FFF; border:#3399FF 1px solid;}
        div.aclb ul {padding:0; margin:0; list-style:none; display:table; vertical-align:middle; }
        div.aclb li {float:left; cursor:default; font-family:Arial; padding:0; margin:0; height:18px;} /*Setting Height here is important. Seems li can have a height>18px on some browsers*/
        div.aclb li.block {padding:0px 2px; height:16px; white-space:nowrap; border:solid 1px #BBD8FB; background:#f3f7fd; font-size:11px; line-height:16px;}
        div.aclb li.block:hover {border:solid 1px #5F8BD3; background:#E4ECF8; color:#000;}

        div.aclb input {margin:0; padding:0; height:18px; background:transparent; border:none; color:#666; overflow:hidden; resize:none; font-family:Arial; font-size:13px; outline:none}
        div.aclb input:focus {margin:0; padding:0; height:18px; background:transparent; border:none; color:#22F; overflow:hidden; resize:none; font-family:Arial; font-size:13px; outline:none;}

        div.aclb a.d {cursor:pointer; display:block; color:#6B6B6B; width:13px; height:12px;float:right; margin:1px 0 1px 4px; border:solid 1px transparent; font-family:Verdana; font-size:11px; text-align:center;  line-height:10px;}
        div.aclb a.d:hover { border:solid 1px #7DA2CE; background:#F7FAFD; color:#AD0B0B;}
        div.aclb a.d:active {border:solid 1px #497CBB; background:#BAD8E8; color:#A90909;}
    </style>
</head>
<body>

<div style="width:250px" class="aclb">
    <ul>
        <li class="block">
            <a class="d">x</a><span>Item 1</span>
        </li>
        <li class="input">
            <input type="text" style="width:300px" maxlength="30"/>
        </li>
    </ul>
</div>

</body>

</html>
  • 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-14T03:01:24+00:00Added an answer on May 14, 2026 at 3:01 am

    You can do that easily by adding another block element around the floated ones, with high width and overflow set to hidden. Also, you’ll need to set overflow:hidden to the original parent container.

    Note that if the width of the floated elements exceed the width of the new block element mentioned above, they will wrap again. So I recommend a high value for that.

    EDIT: I see you have a div with an ul and some li’s inside. So you don’t have to add a new element, since the ul is also a block element and it is already there.

    Here is your code with some corrections:

        <!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" >
    <head>
        <title></title>
        <style type="text/css">
            div.aclb {background:#EEF3FA; color:#666; cursor:text; padding:1px; overflow-y:auto; border:#BBC8D9 1px solid; }
            div.aclb:hover {border:#3399FF 1px solid;}
            div.aclb.focus {background:#FFF; border:#3399FF 1px solid;}
            div.aclb ul {padding:0; margin:0; list-style:none; display:table; vertical-align:middle; }
            div.aclb li {float:left; cursor:default; font-family:Arial; padding:0; margin:0; height:18px;} /*Setting Height here is important. Seems li can have a height>18px on some browsers*/
            div.aclb li.block {padding:0px 2px; height:16px; white-space:nowrap; border:solid 1px #BBD8FB; background:#f3f7fd; font-size:11px; line-height:16px;}
            div.aclb li.block:hover {border:solid 1px #5F8BD3; background:#E4ECF8; color:#000;}
    
            div.aclb input {margin:0; padding:0; height:18px; background:transparent; border:none; color:#666; overflow:hidden; resize:none; font-family:Arial; font-size:13px; outline:none}
            div.aclb input:focus {margin:0; padding:0; height:18px; background:transparent; border:none; color:#22F; overflow:hidden; resize:none; font-family:Arial; font-size:13px; outline:none;}
    
            div.aclb a.d {cursor:pointer; display:block; color:#6B6B6B; width:13px; height:12px;float:right; margin:1px 0 1px 4px; border:solid 1px transparent; font-family:Verdana; font-size:11px; text-align:center;  line-height:10px;}
            div.aclb a.d:hover { border:solid 1px #7DA2CE; background:#F7FAFD; color:#AD0B0B;}
            div.aclb a.d:active {border:solid 1px #497CBB; background:#BAD8E8; color:#A90909;}
        </style>
    </head>
    <body>
    
    <div style="width:250px; overflow: hidden;" class="aclb">
        <ul style="width: 1000px; overflow: hidden;">
            <li class="block">
                <a class="d">x</a><span>Item 1</span>
            </li>
            <li class="input">
                <input type="text" style="width:300px" maxlength="30"/>
            </li>
        </ul>
    </div>
    
    </body>
    
    </html>
    

    I hope it will work for you. 🙂

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

Sidebar

Related Questions

I have a DIV with many elements that are all clickable. Each one with
I have two absolutely positioned div elements that overlap. Both have set z-index values
I have a bunch of CSS written that makes my site target Mobile first,
Having problems with IE8... I have a button that onclick fires the showImageBrowser() function.
I have the following code in a textwidget <div class=social> <a href=http://www.facebook.com/peakit.nl target=_blank><img src=http://www.peaktest.nl/wp-content/uploads/facebook-icon.png
I'm experienced in using media queries to target CSS to specific browser sizes/or contexts,
Is there any CSS hack to target just browsers that do not support the
setTimeout(target.mousedown, 200) doesn't seem to work. I can do setTimeout(target.mousedown(), 200) , but this
my target slideToggle() div needs to be display:inline-block instead of display:block when it's open.
As I understand it you can tell the IE8 (and I assume later versions)

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.