The td content in the table is too long. I want to use... to display it. Key point: I want to click the mouse on... and then a layer will appear on it to display the entire content. Dear brothers and sisters, please help. ah! ! ! ! ! ! ! ! ! ! ! !
It’s useless to talk about the truth, it’s better to give an example and write a comment, thank you! ! ! ! ! ! ! ! ! ! !
I have an idea, use the method of two-level pop-up menu
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style type="text/css">table { border: #CCC 1px solid;}td,th { width: 120px; border: 1px solid #999;}td:hover ul { display: block; }ul { display: none; border: 1px solid #999; list-style: none; margin: 0; padding: 0; position: absolute; width: 120px; background: #CCC;}</style></head><body><table> <tr> <th>标题一</th> <th>标题二</th> </tr> <tr> <td>内容一内容…… <ul> <li>隐藏内容一</li> </ul> </td> <td>内容二内……</td> </tr> <tr> <td>内容三</td> <td>内容四</td> </tr></table></body></html>
I have an idea, use the method of two-level pop-up menu
XML/HTML code? 484950515253
Quote from quanlei1507053 on the 4th floor:
Quote from kxteb0cc on the 2nd floor: I have an idea, use the secondary pop-up menu method
XML/HTML code? 5363738394041424344454647484950515253
Khan. . . . . But thank you anyway
Try the css attribute
text-overflow:ellipsis;
It’s best to write a js to get her~~~
display:block; /*Define as block level*/
overflow:hidden; /*The excess part is hidden. */
white-space:nowrap;/*Replace the non-displayed places with ellipsis...*/
text-overflow:ellipsis;/* Support IE */
-o-text-overflow: ellipsis; /* Supports Opera *
This just allows redundant content to display ellipses within a certain width range, but continuous English letters and numbers are not allowed.
The second question you mentioned is that when you put the mouse over it to display the complete content, use the title. If you still don’t understand, you can send me a private message and I will make a demo for you
If it can help you solve the problem, remember to post and thank you. It’s not easy to earn points.
Luzhu, is it solved?
Please share the code
This can be hidden, and there is...display behind it, but the problem is how to move the mouse above to display the content in the lower right corner of the mouse
Now you can move the mouse up to display it in the lower right. The example is the first and second cells. I hope it will be helpful to you and the people who have the same problem later.
About... This can now be achieved through CSS, text-overflow:ellipsis;
In addition, the title attribute can be used to display the entire content. For example:
This is very simple, let me give you an idea, but I use js to implement it. In fact, just use a question mark expression. When you don’t have the value in td, how many characters need to be displayed, and then use more characters. ... means, for example, you need to have 6 characters in each td and then use... to represent the others, (value.length>6?value.subString(0,6):value), and then you move the mouse Go up and display a layer, and then display what you need on the layer. You can save the things you need in the layer with a hidden layer label. When you want to display it, directly display the image in a mouse move event. Layer is enough. If it is needed for each td, then you will use a span tag in each td to store the actual value of each td. The actual value of each td will be hidden. When the mouse moves in, you can get it directly after the event is fired. Corresponding to the value of the hidden span tag in td, assign it to the layer to be displayed, and then display the layer to complete the function you want. You can try it. This should solve the situation you mentioned. If so, follow up. The method can be posted.
A few question mark expressions are missing...((value.length>6?(value.subString(0,6) "..."):value))
Question marks There are a few missing expressions...((value.length>6?(value.subString(0,6) "..."):value))
This is called a ternary expression, okay?
Is this called a ternary expression?
It’s just a different name. Deng Xiaoping said that a black cat or a white cat is a good cat if it can catch mice. What do you think?
table is forced not to wrap:
table{table-layout:fixed;} td{overflow: hidden; text-overflow: ellipsis;word-break: keep-all;white-space: nowrap;}
In this way, although the ellipses are displayed, the omitted content in td actually exists. You can use some jQuery tip plug-ins to display it, or you can write your own js
Handsome guy, Why didn’t I see that I was given points? I guess that’s fine