Generally, when the border of a table is defined as 1px, that is, border = 1, which is actually 2px. In most cases, we need a table with a real border of 1 px. The following describes several methods. 1. Use nested tables Nested in two tables, the length and width of the outer table are 2 PX more than that of the internal layer, and the alignment attribute is set to horizontal center and vertical center, set the background of the outer table to the border color you need, and set the background of the inner table to the same as that of the webpage. The example is as follows: <Table cellspacing = "1" cellpadding = "0" bgcolor = "#000000" width = "32" Height = "32" border = "0"> <Tr> <TD align = "center"> <Table cellspacing = "0" cellpadding = "0" bgcolor = "# ffffff" width = "30" Height = "30" border = "0"> <Tr> <TD> </TD> </Tr> </TD> </Tr> </Table> 2. Set the bright and dark border colors The table has two attributes: bordercolorlight and bordercolordark. Set the border of the table (Border) to 1px, the border (bordercolorlight) to the background color, and the border (bordercolordark) set the actual border color as needed. The actual column is as follows: <Table border = "1" cellpadding = "0" cellspacing = "0" width = "32" Height = "32" bordercolorlight = "#000000" bordercolordark = "# ffffff"> <Tr> <TD> </TD> </Tr> </Table>
Iii. Define with CSS (1) CodeFormat = "border-collapse: collapse" Example: <Table border = "1" cellspacing = "0" width = "32" Height = "32" style = "border-collapse: collapse "bordercolor =" #000000 "cellpadding =" 0 "> <Tr> <TD> </TD> </Tr> </Table> Iv. Define with CSS (2) Code: Style = "border: 1px solid #000000 ;" Example: <Table cellspacing = "0" cellpadding = "0" border = "0" width = "32" Height = "32" style = "border: 1px solid #000000;"> <Tr> <TD> </TD> </Tr> </Table> Note: Do not set the attributes of the border, border, and border. Otherwise, the expected results will not appear. |