The problem in question is split into two:
1. How do I use ellipsis instead of text when the length is exceeded?
2. How long is the length of the text after the omission of the display, how to hover when the mouse, in the form of a floating box to display all the information?
How do I implement ellipsis instead of text when it exceeds length?
Using CSS to implement a very long field with ellipses notation method: all browser compatible!
The HTML code is as follows:
<div style= "Width:150px;overflow:hidden; White-space:nowrap; Text-overflow:ellipsis ">
using CSS to implement a very long field is omitted simple method
</div>
Note: set width, Overflow:hidden, white-space:nowrap, text-overflow:ellipsis four attributes are indispensable. This type of writing can be displayed correctly in all browsers.
How to display all the information in the form of a hover box when the mouse hovers over a long length of text after omitting the display? (This only discusses how to display in a floating box)
The first way: Use the title attribute in the div:
Let's start with a simple, straightforward example:
<div style= ' width:120px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden ' title= ' mouse hover display content ' > Mouse hover content </div>
<!--This content because it is inside Div, is control div width to show you need to see a few words of length, exceed will show ...-->
<!--title: hint Information, The cue information that the mouse puts on the element that is displayed-->
Display effects, as shown in the following figure:
The second way: Bind the mouse over the div in the event
Separate div (including id attribute) is displayed through the suspension box, and the following code is tested through Google Browser:
Multiple div (including class attribute) is displayed through a floating box:
Because the distance between the div tags, in the mouse suspension, the suspension box will appear fast flash, you can adjust the space between the Div, to improve, or directly to the P tag can also.
The problems that exist:
When the mouse hovers over, omitted content in all show out, will squeeze the content below, when it is more than line display, easy to cause page confusion. Figure:
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.