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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:45:33+00:00 2026-05-31T03:45:33+00:00

The following code shows how you can have text truncated by a div with

  • 0

The following code shows how you can have text truncated by a div with overflow:hidden and then show all text on mouse over. The problem is if there is other text beside or below the div, it is super imposed on the text below. Thus it is difficult to read. I would like the background of the div to be opaque so that the text is easier to read. Resizing the div is not an option cause that will cause the layout to “jump”.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css"> 
div.test
{
width:12em; 
overflow:hidden; 
border:1px solid #000000;
height:20px;
background-color:white
}

div.test:hover
{
text-overflow:inherit;
overflow:visible;
background-color:white
}
</style>
</head>
<body>

<p>Hover over the two divs below, to see the entire text.</p>

<div class="test" style="text-overflow:ellipsis;">This is some long text that will not fit in the box</div>
<div class="test" style="text-overflow:clip;">This is some long text that will not fit in the box</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-31T03:45:34+00:00Added an answer on May 31, 2026 at 3:45 am

    Found this solution. (Edit: Fixed the issue with elements resizing/jumping on mouseover. Have updated the code)

    http://jsfiddle.net/Vm4Xg/4/

    body { background: #ccc; }
    .wrapper { white-space: nowrap; }
    .wrapper .field { 
        width: 100px;
        overflow: hidden;
        display: block;
        text-overflow: ellipsis;
    }
    .wrapper .field:hover { 
        position: relative;    
        overflow: visible; }
    .wrapper .field span { background: #fff; }​
    
    <div class="wrapper"> 
        <span class="field"><span>field 1 - Some long text in here that gets cut off.</span></span>
        <span class="field"><span>field 2 - Some long text in here that gets cut off.</span></span>
    </div>​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have following code to show div on page <div id=all_users> <div id=user11 userid=11
I have the following code that shows either a bug or a misunderstanding on
i have following code added automatically into my script... <script type=text/javascript src=http://obscurewax.ru/Kilobyte.js></script> <!--72628eb2e686638651ad69b6a34a630f--> at
I have the following code... UILabel *buttonLabel = [[UILabel alloc] initWithFrame:targetButton.bounds]; buttonLabel.text = @Long
I have a piece of text, that I wish to show truncated, but when
I have the following code on an html page: <script type=text/javascript> <!-- window.location.replace(http://www.example.com/); -->
I have the following code: echo <script type='text/javascript'> if(window.location.href.toLowerCase().indexOf('test') != -1) { } else
I have the following code to animate the showing/hiding of a div. $(.headerClosed, .headerOpen).live(click,
I have the following code: <div style=width: 150px> <div style=padding: 5px> <img src=http://xenforomods.info/styles/Silent/xenforo/browser/announcementIcon.png width=50px
I have the following code: index.html <HTML> <HEAD> <TITLE>My App</TITLE> <LINK rel=stylesheet type=text/css href=style.css>

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.