HTML Table table background color

 HTML Table table background color can be designed with HTML traditional bgcolor. Interested readers can refer to the introduction of HTML Background Color ". Another popular way to design table background color is to use the background-color property of CSS . The design and usage are similar to the traditional HTML bgcolor, and can be better integrated with the overall CSS syntax. The mainstream of the new generation of web design, in order to let you see the usage of HTML bgcolor and the design of CSS background-color , This article will use these two techniques as examples to design table background colors for HTML. If you want to use HTML5 for web page design in the future CSS syntax is recommended Example 1: Use HTML bgcolor to design the table background color


<table bgcolor="black" cellpadding="5" border="0">
<tr>
 <td bgcolor="red">Red table column background color</td>
 <td bgcolor="yellow">Yellow Table field background color</td>
 <td bgcolor="blue">Blue table field background color</td>
</tr>
</table>
Present results
Red table column background colorYellow table column background colorBlue table column background color
Example of a table in the beginning of the table using the label "bgcolor =" black "," such wording, on behalf of the entire table's background color is black, then why three field background color is not the same? Because each field (td) in the example also uses the background color attribute of bgcolor, and is designed with different colors, the final rendering effect will see a table with black borders like this , if the field If bgcolor is not used, it will be black because the background color of the table is black.

For remarks and basic grammar of table design, please refer to: HTML table .

Example 2: Use css background-color to design the table background color
<table style="background-color:black;" cellpadding="5" border="0">
<tr>
 <td style="background-color:red">Red table column background color</td>
 < td style="background-color:yellow">Yellow table field background color</td>
 <td style="background-color:blue">Blue table field background color</td>
</tr>
</table>
Present results
Red table column background colorYellow table column background colorBlue table column background color
Examples Table II presents exactly the same effect as a paradigm, but the syntax has been used in CSS 's background-color design, code style place to start is the example of CSS syntax declaration, the other parts are the same as a paradigm, if If you want to further study the CSS background color or background image design method, please refer to these two articles.
  • CSS background-color background color
  • CSS background-image background image
After reading the above two examples, you should have an understanding of the design of the background color of the HTML table, but where do you choose different colors? The " Color Code Table " provided by this site has more than four hundred hexadecimal color codes, allowing you to easily choose different colors to design the background color of the table.

Post a Comment

0 Comments