The width of table cell td is invalid. Internal content is always supported. _ HTML/Xhtml _ webpage Creation

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.