Table related arrangement and Javascript operation table, tr, td

Table related arrangement and Javascript operation table, tr, td
Table property settings that work well:

Copy code
The code is as follows:

<table cellSpacing="0" cellPadding="0" border='1' bordercolor="black"
style='border-collapse:collapse;table-layout: fixed'></table>

Many people have had this experience: when there is no content or no visible elements in a td, the border of the td will also disappear. The solution is to add the style border-collapse:collapse to the table
General text truncation (applies to both inline and block):

Copy code
The code is as follows:

.text-overflow{
display:block;/*Inline objects need to be added*/
width:31em;
word-break:keep-all;/* No line break*/
white-space:nowrap;/* No line break*/
overflow:hidden;/*Hide the excess content when the content exceeds the width*/
text-overflow:ellipsis; /* Displays an ellipsis mark (...) when the text overflows within an object; must be used together with overflow:hidden;. */
}

For tables, the definition is a little different:

Copy code
The code is as follows:

table{
width:30em;
table-layout:fixed;/* The following td definition will work only if the table layout algorithm is defined as fixed. */
}
td{
width:100%;
word-break:keep-all;/* No line break*/
white-space:nowrap;/* No line break*/
overflow:hidden;/*Hide the excess content when the content exceeds the width*/
text-overflow:ellipsis; /* Displays an ellipsis mark (...) when the text overflows within an object; must be used together with overflow:hidden;. */
}

Javascript operations table, tr, td

Copy code
The code is as follows:

table.moveRow(m,n) //Exchange the rows of the table (IE) The rows between m and n are moved in sequence
table.deleteRow(index) // row deletion
table.insertRow(index) //Insert a row at index and return the TR
tr.insertCell(index) //Insert a cell and return the TD
tr.deleteCell(index)
tr.rowIndex // Returns the position of tr in the table
td.cellIndex //Return the position of td in tr

<<:  25 Examples of News-Style Website Design

>>:  Use CSS to draw a file upload pattern

Recommend

IE6/7 is going to be a mess: empty text node height issue

Preface: Use debugbar to view document code in iet...

JavaScript data flattening detailed explanation

Table of contents What is Flattening recursion to...

Detailed explanation of CSS image splicing technology (sprite image)

CSS image splicing technology 1. Image stitching ...

Regarding the Chinese garbled characters in a href parameter transfer

When href is needed to pass parameters, and the p...

Detailed tutorial for installing MySQL 8.0.11 compressed version under win10

After reinstalling my computer recently, I downlo...

Detailed installation process and basic usage of MySQL under Windows

Table of contents 1. Download MySQL 2. Install My...

IDEA graphic tutorial on configuring Tomcat server and publishing web projects

1. After creating the web project, you now need t...

vitrualBox+ubuntu16.04 install python3.6 latest tutorial and detailed steps

Because I need to use Ubuntu+Python 3.6 version t...

Boundary and range description of between in mysql

mysql between boundary range The range of between...

Vue implements 3 ways to switch tabs and switch to maintain data status

3 ways to implement tab switching in Vue 1. v-sho...

Solve the problem of HTML automatic formatting after saving in vscode

The version of vsCode has been updated in recent ...

mysql 5.6.23 winx64.zip installation detailed tutorial

For detailed documentation on installing the comp...