How to set the height of td in table to 1px and tabletd1px

Source: Internet
Author: User
Tags border color

How to set the height of td in table to 1px and tabletd1px

When creating edm, you will encounter the need to set the td height to 1px. If the td label has & nbsp;, no matter how you set the td height, it will be useless. The minimum height is 18px,

Remove & nbsp; from the table. Example:

It turns out to be like this:

<Tr>
<Td width = "20" height = "1"> & nbsp; </td>
<Td width = "607"> & nbsp; </td>
<Td width = "20"> & nbsp; </td>
</Tr>

You need to change it to the following:

<Tr>
<Td width = "20" height = "1"> </td>
<Td width = "607"> </td>
<Td width = "20"> </td>
</Tr>

Remove & nbsp; from td to solve the problem.


In the table of html, I set it to 2 rows and 1 column, where the height of one row is 1px,

<Tr>
<Td height = "1"> nbsp; </td>
</Tr>

Remove the spaces (nbsp;) between <td> </td> &

[URGENT] using table as a web page and setting the border to 1px is still very rough?

Because the border is so thick as 1px by default, you can use other methods to implement the border.

There are several ways to set the fine border of a Table:

1. Set BORDER = 0 and cellspacing = 1 for the BORDER, set the background color of the Table to the BORDER color, and set the background color of all td to white, so that the BORDER is displayed. This method is a bit evil, seemingly not authentic, but it can also achieve the effect, a great way to Rome!

Let's take a look at the second method:

2. Set BORDER = 0, add 1 px border-top and border-left to the Table through CSS, and then set border-right and border-bottom of all td data, this can also achieve the desired effect. It can be seen that CSS is very powerful.

In practice, we found that the HTML generated in the above two methods is opened in Word, and the expected effect cannot be achieved. What should I do !?

The following describes a simpler and more effective method:

3. Set CSS of table to {border-collapse: collapse; border: none;}, and set CSS of td to {border: solid #000 1px! In addition, Word can recognize this setting.

The style sheet is as follows:
Table # border {
Border-top: #000 1px solid;
Border-left: #000 1px solid;
}
Table # border td {
Border-bottom: #000 1px solid;
Border-right: #000 1px solid;
}
Then add the html file with the border
<Table id = "border" border = "0" cellspacing = "0">

The table in CSS indicates that the modified object is table, # indicates that this is an ID.

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.