The width of td is always supported by internal content. You can set padding, but setting width Directly does not work. The following is an example. For details, refer to the following table Page, sometimes the width set for td is invalid. The width of td is always supported by internal content. You can set padding, but the width setting is invalid. Let's take a look at this example:
The Code is as follows:
| 1000800 |
1000000 |
1000000 |
| 1000000 |
10000300 |
1000000 |
| 1000000 |
1000000 |
1000000 |
| 1000000 |
10000300 |
1000000 |
* {Margin: 0; padding: 0 ;}
. P1 {position: relative; width: 150px; height: 100px; overflow: scroll; border: 1px solid red ;}
We can see that although the width of the first cell in class p1 is set, it is invalid. The cell content is always determined by the content, so since it is determined by the content, we will try to open the cell with "content.
We can add a p in td, and then set the width of p to give it a try:
Modify some code in class p1:
The Code is as follows:
1000800
Change
The Code is as follows:
1000800
Then write in the style:
The Code is as follows:
Td p {
Width: 100px;
}
Refresh the page. The effect is as follows:
We can see that the cell width in class p1 has taken effect.