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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:30:22+00:00 2026-06-14T07:30:22+00:00

How to crop text when the width of element is dynamic? It’s possible to

  • 0

How to crop text when the width of element is dynamic?

It’s possible to crop text when width of element is fixed:

.my-class {
  width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

But how to do it when width is dynamic?

Real example – header of application with the title floating at the left and the toolbar floating at the right:

enter image description here

The title should take all free place but not more:

enter image description here

How to crop text in such dynamic title?

Code to play live http://cssdeck.com/labs/fbe2t2qo/0

  • 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-14T07:30:24+00:00Added an answer on June 14, 2026 at 7:30 am

    As it turned out it’s actually possible to do, changes are:

    • set the toolbar first in the html and make it floated to the right.
    • set text overflow on title.

    HTML

    <div class='header'>
        <div class='header-toolbar'>
            <button>Create</button>
        </div>
        <div class='header-title'>
            Very very very very very long very very very long title
        </div>
    
        <div class='clearfix'></div>
    </div>
    

    CSS

    .header, .header-title, .header-toolbar {
        border: 1px solid black;
        margin: 3px;
        padding: 3px;
    }
    
    .header-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .header-toolbar {
        float: right;
    }
    
    .clearfix {
        clear: both;
    }
    

    Code http://cssdeck.com/labs/na24g9nf/0

    P.S.

    It’s not my answer, it was answered by this guy http://www.sql.ru/forum/memberinfo.aspx?mid=114453 in this thread http://www.sql.ru/forum/actualthread.aspx?tid=979934

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

Sidebar

Related Questions

I have the following: CSS: .photo { overflow: hidden; display: table-cell; vertical-align: middle; text-align:
I want to crop an image. Is it possible to do like this. And
I have written a recursive function in PHP to crop text. The cropped text
I have a div with overflow:hidden , inside which I show a phone number
So my questions is similar to this: crop text too long inside div What
Im attempting to crop a pretty high res image and save the result to
I want to crop images using the GD, but I want it to crop
If i wanted to crop an image in VB.net, how would I go about
I need to crop an image on a Powerpoint slide using VBA - in
I want to crop images in PHP. Cropping in rectangular shape is all common

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.