After setting the table width in the page to width="600px", the width is still not fixed. The text does not wrap when it is too long, which deforms the table. Solution: 1. Table sets width, both absolute and relative width are acceptable table-layout:fixed; With this property set, all remaining td's will have the same width. After this operation, the width of the table is fixed, but if the article inside is very long, the text will cover the Solution: Add style="word-wrap:break-word;" to the td to wrap the text. If you don't want to wrap the text, you can hide the content that exceeds the limit and replace it with an ellipsis: Add above td Copy code The code is as follows:overflow:hidden; white-space:nowrap; text-overflow:ellipsis; (currently only tested in IE8) Recommended method (2013-11-14 by Zhang Lei) Use div to control the content of td Add in TD (1) Text will be automatically hidden if it exceeds the width and height Copy code The code is as follows:<div style="width:100px;height:25px;overflow-x:hidden;overflow-y:hidden;">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div> (2) Set the TD width to automatically wrap when it exceeds the length Copy code The code is as follows:<td><div style="width:100px;word-wrap:break-word;" >aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div> </td> |
<<: Explore how an LED can get you started with the Linux kernel
>>: Introduction to document.activeELement focus element in JavaScript
When the DataSource property of a DataGrid control...
To debug js code, you need to write debugger in t...
Scenario 1: Html: <div class="outer"...
byzhangxinxu from https://www.zhangxinxu.com/word...
introduction During the front-end project develop...
Table of contents Preface use Component Writing D...
How to install flash in Linux 1. Visit the flash ...
Note: sg11 Our company only supports self-install...
Thanks to the development of the Internet, we can...
In the official MySQL dump tool, how can I restor...
Table of contents Overview 1. Define store.js 2. ...
Preface Since many friends say they don’t have Ma...
Copy code The code is as follows: html { overflow...
Today I made a menu button. When you move the mous...
Enable remote access to MySQL By default, MySQL u...