


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

AI Hentai Generator
Generate AI Hentai for free.

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

In Vue.js, the placeholder attribute specifies the placeholder text of the input element, which is displayed when the user has not entered content, provides input tips or examples, and improves form accessibility. Its usage is to set the placeholder attribute on the input element and customize the appearance using CSS. Best practices include being relevant to the input, being short and clear, avoiding default text, and considering accessibility.

The span tag can add styles, attributes, or behaviors to text. It is used to: add styles, such as color and font size. Set attributes such as id, class, etc. Associated behaviors such as clicks, hovers, etc. Mark text for further processing or citation.

REM in CSS is a relative unit relative to the font size of the root element (html). It has the following characteristics: relative to the root element font size, not affected by the parent element. When the root element's font size changes, elements using REM will adjust accordingly. Can be used with any CSS property. Advantages of using REM include: Responsiveness: Keep text readable on different devices and screen sizes. Consistency: Make sure font sizes are consistent throughout your website. Scalability: Easily change the global font size by adjusting the root element font size.

There are five ways to introduce images in Vue: through URL, require function, static file, v-bind directive and CSS background image. Dynamic images can be handled in Vue's computed properties or listeners, and bundled tools can be used to optimize image loading. Make sure the path is correct otherwise a loading error will appear.

The SPAN tag is an inline HTML tag that is used to highlight text by applying attributes such as style, color, and font size. This includes emphasizing text, grouping text, adding hover effects, and dynamically updating content. It is used by placing <span> and </span> tags around the text you want to emphasize, and is manipulated via CSS styling or JavaScript. The benefits of SPAN tags include semantic clarity, styling flexibility, and ease of maintenance.

When using the prompt() method in JavaScript, you can achieve line breaks through the following three methods: 1. Insert the "\n" character at the position where you want to break the line; 2. Use the line break character in the prompt text; 3. Use CSS's "white" -space: pre" style forces line breaks.

Browser plug-ins are usually written in the following languages: Front-end languages: JavaScript, HTML, CSS Back-end languages: C++, Rust, WebAssembly Other languages: Python, Java

Nodes are entities in the JavaScript DOM that represent HTML elements. They represent a specific element in the page and can be used to access and manipulate that element. Common node types include element nodes, text nodes, comment nodes, and document nodes. Through DOM methods such as getElementById(), you can access nodes and operate on them, including modifying properties, adding/removing child nodes, inserting/replacing nodes, and cloning nodes. Node traversal helps navigate within the DOM structure. Nodes are useful for dynamically creating page content, event handling, animation, and data binding.
