Table of Contents
Reply to the discussion (solution)
Home Web Front-end HTML Tutorial The td content in the table is too long, I want to use it. . . show_html/css_WEB-ITnose

The td content in the table is too long, I want to use it. . . show_html/css_WEB-ITnose

Jun 24, 2016 pm 12:19 PM

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! ! ! ! ! ! ! ! ! ! ! !


Reply to the discussion (solution)

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>
Copy after login

I have an idea, use the method of two-level pop-up menu


XML/HTML code? 484950515253



You can’t do this. What I mean is that if the content is too long, it will be displayed... and then move the mouse... and a layer will appear on top to display the entire content. If the content is not long, it will not be displayed. It will appear..., and the layer will not appear to display when the mouse moves the above content

I have an idea, use the secondary pop-up menu method

XML/ HTML code? 253


The difficulty is to judge, not long The content (will not be displayed...) The layer will not appear when moving

Quoting the reply from kxteb0cc on the 2nd floor: I have an idea, using the secondary pop-up menu method


XML/HTML code? 7484950515253

Uh, I understand what you mean, do you want It automatically determines whether the content is too long and then automatically hides it. I don’t know about this, but I guess it requires javascript...

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

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Is HTML easy to learn for beginners? Is HTML easy to learn for beginners? Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Apr 04, 2025 pm 11:54 PM

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

What is an example of a starting tag in HTML? What is an example of a starting tag in HTML? Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

How to use CSS3 and JavaScript to achieve the effect of scattering and enlarging the surrounding pictures after clicking? How to use CSS3 and JavaScript to achieve the effect of scattering and enlarging the surrounding pictures after clicking? Apr 05, 2025 am 06:15 AM

To achieve the effect of scattering and enlarging the surrounding images after clicking on the image, many web designs need to achieve an interactive effect: click on a certain image to make the surrounding...

HTML, CSS, and JavaScript: Essential Tools for Web Developers HTML, CSS, and JavaScript: Essential Tools for Web Developers Apr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

How to distinguish between closing a browser tab and closing the entire browser using JavaScript? How to distinguish between closing a browser tab and closing the entire browser using JavaScript? Apr 04, 2025 pm 10:21 PM

How to distinguish between closing tabs and closing entire browser using JavaScript on your browser? During the daily use of the browser, users may...

See all articles