


CSS: Detailed explanation of the role and use of the table-layout attribute
I have seen a lot of usage of CSS before, but I have not seen much about some properties that are not called less used. Today I was reading a post on Classic and found a discussion on the topic "How to use CSS to force TD not to wrap?" , I discovered the detailed explanation of the use of table-layout, and posted the content first:
Syntax:
table-layout: auto | fixed
Value:
auto:Default value. Default automatic algorithm. The layout will be based on the contents of each cell. The table will not be displayed until all contents in each cell are read and calculated.
fixed: Fixed layout algorithm. In this algorithm, the width of the table and columns depends on the sum of the widths of the col objects, or, if not specified, the width of each cell in the first row. If the table does not specify a width (width) attribute, the table is rendered with a default width of 100%.
Description:
Set or retrieve the layout algorithm of the table.
You can improve table rendering performance through this attribute. This property causes IE to render the table contents one row at a time thereby providing greater speed to information users. This property uses one of the following methods to arrange the table column width according to the following order:
Use the width (width) attribute information of the col or colGroup object.
Use the width (width) information of the cell in the first row of the table.
Divide the table width equally according to the number of table columns. regardless of the actual width of the table content.
If the content of the cell exceeds the column width, the content will be wrapped. If line wrapping is not possible, the content will be cropped. If this property is set to fixed, overflow can be used to control the handling of content that overflows the width of the cell (td). If the table row height is specified, then the wrapped content will be cropped vertically if it exceeds the specified table row height.
Set this attribute value to fixed to help improve table performance. The effect is especially significant for long tables.
Setting the table row height can further improve the rendering speed. The browser does not need to detect the content of each cell in the row to determine the row height before starting parsing and rendering.
This property is read-only for currentStyle objects. For other objects can be read and written.
The corresponding script attribute is tableLayout.
Note the following points:
1, you can improve table rendering performance through this attribute. This property causes IE to render the table contents one row at a time thereby providing greater speed to information users.
2. Set this attribute value to fixed to help improve table performance. The effect is especially significant for long tables.
3. Setting the table row height can further improve the rendering speed. The browser does not need to detect the content of each cell in the row to determine the row height before starting parsing and rendering.
------------------------------------------- -----
This feature is very useful for the speed and effect of long table display. Can be used to improve table performance!
The author's question is also quite interesting. The requirements are as follows:
1. In TD, do not have the nowrap attribute. You must find a way to put nowrap in CSS.
2. In TD, do not Line breaks are allowed, and the excess parts must be hidden!
Final implementation method (note that DTD cannot be added here, otherwise it cannot be implemented, I don’t know why):
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style> .aa{ table-layout : fixed; } td{ overflow:hidden; height:22px; } </style> </head> <body> <!-- var grid1=new JGrid(null,300); grid1.create(); var fldsList=new Array(['bag',120],['name',200],['type',100]); grid1.createTitle(fldsList); grid1.tackData("dataLayer") //--> <table class="aa" border="1" cellpadding="0" cellspacing="0" bordercolor="#F9F9F9" id="dataLayer"> <colgroup> <col width="119" /> <col width="199" /> <col width="99" /> </colgroup> <tbody> <tr basestyle="oRowLine2"> <td>J2SE</td> <td>Java 2 Standard Edition </td> <td> </td> </tr> <tr basestyle="oRowLine1"> <td>J2EE</td> <td>Java 2 Enterprise Edition </td> <td> </td> </tr> <tr basestyle="oRowLine2"> <td>J2ME</td> <td>Java 2 Micro Edition </td> <td> </td> </tr> <tr basestyle="oRowLine1"> <td>GPS</td> <td>Global Positioning System </td> <td>全球定位系统</td> </tr> <tr basestyle="oRowLine2"> <td>CDMA</td> <td>Code Division Multiple Access </td> <td>码分多址</td> </tr> <tr basestyle="oRowLine1"> <td>SMS</td> <td>Short Message Service </td> <td>短信息服务</td> </tr> <tr basestyle="oRowLine2"> <td>BREW</td> <td>Binary Runtime Environment for Wireless </td> <td> </td> </tr> <tr basestyle="oRowLine1"> <td>Symbian</td> <td> </td> <td> </td> </tr> <tr basestyle="oRowLine2"> <td>Windows Mobile Smartphone </td> <td> </td> <td> </td> </tr> <tr basestyle="oRowLine1"> <td>MIDlet</td> <td> </td> <td>按MIDP规范开发的J2ME应用程序</td> </tr> <tr basestyle="oRowLine2"> <td>MIDP</td> <td>Mobile Information Device Profile </td> <td>移动信息设备框架</td> </tr> <tr basestyle="oRowLine1"> <td>Profile</td> <td> </td> <td>框架/简表</td> </tr> <tr basestyle="oRowLine2"> <td>CLDC</td> <td>Connected Limited Device Configuration </td> <td>标准配置</td> </tr> <tr basestyle="oRowLine1"> <td>CDC</td> <td>Connected Device Configuration </td> <td> </td> </tr> <tr basestyle="oRowLine2"> <td>KVM</td> <td>K virtual Machine </td> <td> </td> </tr> <tr basestyle="oRowLine1"> <td>SDK</td> <td>Software Development Kit </td> <td>软件开发工具包</td> </tr> <tr basestyle="oRowLine2"> <td>JAR</td> <td>Java ARchive </td> <td> </td> </tr> <tr basestyle="oRowLine1"> <td>JAD</td> <td>Java Application Descriptor </td> <td>应用程序描述符</td> </tr> <tr basestyle="oRowLine2"> <td>GCF</td> <td>General Connection Framework </td> <td> </td> </tr> <tr basestyle="oRowLine1"> <td>RMS</td> <td>Record Management System </td> <td>记录管理系统</td> </tr> <tr basestyle="oRowLine2"> <td>Sprite</td> <td> </td> <td>精灵</td> </tr> <tr basestyle="oRowLine1"> <td> </td> <td> </td> <td>冲突检查</td> </tr> <tr basestyle="oRowLine2"> <td> </td> <td> </td> <td>平铺图层</td> </tr> </tbody> </table> </body> </html>
The above is the detailed content of CSS: Detailed explanation of the role and use of the table-layout attribute. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

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

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.

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-
