About the layout method of content overflow in table

About the layout method of content overflow in table

What is content overflow? In fact, when there is a lot of text, if the content area is only that long, then the extra part will be replaced by dots.

The case we are doing this time is in a table. We know that when we enter too much text content in a table, the table will be messed up, for example, a line will be displayed too long or automatically wrapped. But sometimes we just want to display it in a row of fixed width, and if there is any extra part, we can replace it with dots, so as not to clutter the table. So what to do?

Generally we will use the following attributes

CSS CodeCopy content to clipboard
  1. /*Overflow part style*/   
  2. .txt-ell {
  3.      white white-space : nowrap ; //Force to display in one line
  4.      overflow : hidden ; //Cut and hide overflow content
  5. text- overflow :ellipsis; //When the inline overflows the block container, replace the overflow part with...
  6. word-break:keep- all ; //Allow line breaks within words
  7.      color : red ; // I will mark it here myself
  8.      padding : 0 7px ; //Because I want to leave some distance from the edge, I set the following
  9. }
CSS CodeCopy content to clipboard
  1. .table-fix {
  2.      table-layout : fixed ;
  3. }

First of all, the second style is specifically added to the table tag. If you want to achieve content overflow, the table must have a fixed width and height, and the tr and td inside the table must also have a fixed width and height. Before using content overflow, add the table-fix class to the table. Then check if your tr and td have a width. If not, it is best to give one. It can be fixed or in percentage. I mainly give percentages. The outer table has a fixed width, and the tr and td inside have a percentage width. This way, you can use the content overflow style. Finally, if there is a lot of content in a grid and you want to implement dots, add a .txt-ell class to this grid.

The above article about the content overflow layout method in the table is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

Original URL: http://www.cnblogs.com/hanyining/archive/2016/05/25/5527668.html

<<:  CSS3 creates 3D cube loading effects

>>:  Detailed explanation of Vue3's responsive principle

Recommend

Common shell script commands and related knowledge under Linux

Table of contents 1. Some points to remember 1. V...

Nginx domain forwarding usage scenario code example

Scenario 1: Due to server restrictions, only one ...

Detailed explanation of JavaScript axios installation and packaging case

1. Download the axios plugin cnpm install axios -...

Solution to prevent caching in pages

Solution: Add the following code in <head>: ...

Today I encountered a very strange li a click problem and solved it myself

...It's like this, today I was going to make a...

What are the new features of Apache Spark 2.4, which will be released in 2018?

This article is from the Apache Spark Meetup held...

Detailed explanation of how to use Vue to load weather components

This article shares with you how to use Vue to lo...

HTML markup language - reference

Click here to return to the 123WORDPRESS.COM HTML ...

JS implements simple addition and subtraction of shopping cart effects

This article example shares the specific code of ...

Detailed installation and uninstallation tutorial for MySQL 8.0.12

1. Installation steps for MySQL 8.0.12 version. 1...

Why is the scroll bar on the web page set on the right?

Why are the scroll bars of the browsers and word ...

Docker image analysis tool dive principle analysis

Today I recommend such an open source tool for ex...

MySQL query redundant indexes and unused index operations

MySQL 5.7 and above versions provide direct query...