Get the App
SLTechnology News&Howtos  ›  Development  › 

What if the width of the html table cell td setting is invalid

Shulou Source: shulou.com Published: 2022-06-01 06:50:48 10月16日 Update

Editor to share with you about the html table cell td setting width invalid how to do, I believe that most people do not understand, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!

When making table pages, sometimes the width set for td is invalid. The width of td is always supported by internal content. You can set padding, but it is not effective to set width directly. Let's take a look at this example:

1000800

1000000

1000000

1000000

10000300

1000000

1000000

1000000

1000000

1000000

10000300

1000000

* {margin:0;padding:0;}

.div1 {position:relative;width:150px;height:100px;overflow:scroll;border:1pxsolidred;}

We can see that the first cell in the class div1 sets the width, but it is invalid. The content of the cell is always determined by the content, so since it is determined by the content, we will find a way to get the "content" to prop up the cell.

We can add a div to the td, and then set the width for the div to try:

Modify part of the code in the class div1:

1000800

Modify to

1000800

Then write in the style:

Tddiv {

Width:100px

}

The above is all the contents of the article "what to do if the width of the html table cell td is invalid". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Width content units articles what to do tables not much code methods most of which are made up of more styles knowledge examples industry information channels pages channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info MariaDB Redmi NVidia Docker