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>
Found this solution. (Edit: Fixed the issue with elements resizing/jumping on mouseover. Have updated the code)
http://jsfiddle.net/Vm4Xg/4/