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
1. Compatibility As shown below: The compatibilit...
1. Problem The project developed using Eclipse on...
“Inputs should be divided into logical groups so ...
Preface I recently encountered a problem at work....
I encountered a sql problem at work today, about ...
Mini Program Custom Scroll-View Scroll Bar Withou...
This article example shares the specific code for...
The first step is to install TypeScript globally ...
Resource merging and compression for two purposes...
Preface Samba is a free software that implements ...
The following is an introduction to using SQL que...
SQL statement DROP TRIGGER IF EXISTS sys_menu_edi...
Preface In this article, we'll explore the ev...
Table of contents Overview Code Implementation Su...
An at-rule is a declaration that provides instruc...