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
One purpose Select a local folder on the Html pag...
Apache Arrow is a popular format used by various ...
Table of contents 1. Concept 2. Environmental Des...
I reinstalled the system some time ago, but I did...
Configuring network connectivity for Linux system...
What is the main function of Docker? At present, ...
There has been a lot of discussion about H1 recent...
Additional explanation, foreign keys: Do not use ...
Table of contents 1. Recipe Collection 1.1 Projec...
Use indexes to speed up queries 1. Introduction I...
The differences among execute, executeUpdate, and...
Table of contents Preface 1. The effect is as sho...
As a technical novice, I am recording the process...
For several reasons (including curiosity), I star...
1. Complex SQL queries 1.1. Single table query (1...