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

  • Home
  • SEARCH
  • 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 7717791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:59:34+00:00 2026-06-01T02:59:34+00:00

I have a floated span with some text. I have set the overflow to

  • 0

I have a floated span with some text. I have set the overflow to hidden and the width to a fixed width say 100px.

Now when the text becomes too long it just wraps.

I don’t want to set the height to a fixed px because that way if I change the font-size I may forget to update the height and so on.

<span style="float:left;overflow:hidden;width:100px;">Very Long Text</span>
  • 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-01T02:59:35+00:00Added an answer on June 1, 2026 at 2:59 am

    Sounds like you might want to try something like:

    CSS:

    .floated-element {
        float:left; /* Or right, whatever */
        width:100px;
        white-space:no-wrap; /* Keeps the text to one line */
        text-overflow:ellipsis; /* This will add ... to the end of text that extends beyond 100px */
        overflow:hidden;
    }
    

    HTML:

    <div class="floated-element">
        ...
    </div>
    

    If you really want to use a <span> rather than a floated <div>, you’ll want to set the span’s display to inline-block. This will let you specify the width while keeping its other inline attributes.

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

Sidebar

Related Questions

I have list items, with a span, set to inline-block and floated right. This
How to vertically align the text in a floated div? For example: I have
I have three span tags: One is floated left (A) and the other two
I have 1 span within a container div. I want the span floated to
I have a simple layout with content floated-left and a fixed-positioned menu on the
I have some question about when floated elements need and don't need to be
I have CSS floated elements with predefined width and I want them to transpose
I need to have a floated element after the content/text that's supposed to flow
I'm creating an ASP.NET site where some pages need to have a div floated
I have some floated div's and I want to select the third with jquery.

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.