CSS Settings <tr>
Elements
In HTML tables, the <tr>
elements define table rows. CSS can be used to set the style of <tr>
elements, such as background color, border, alignment, etc.
Use the background-color
attribute to set the background color of the <tr>
element. Here's an example:
tr { background-color: yellow; }
This will make the background color of all <tr>
elements yellow.
Use the border
attribute to set the border of the <tr>
element. Here's an example:
tr { border: 1px solid black; }
This will add a solid black border of 1 pixel thickness to all <tr>
elements.
Use the text-align
attribute to set the horizontal alignment of the <tr>
element. Here's an example:
tr { text-align: center; }
This will center align the content of all <tr>
elements horizontally.
Use the vertical-align
attribute to set the vertical alignment of the <tr>
element. Here's an example:
tr { vertical-align: middle; }
This will center-align the content of all <tr>
elements vertically.
Use the color
attribute to set the font color of the <tr>
element. Here's an example:
tr { color: blue; }
This will make the text in all <tr>
elements blue.
Use the font-family
and font-size
attributes to set the font and size of the text in the <tr>
element. Here's an example:
tr { font-family: Arial; font-size: 14px; }
This will make the text in all <tr>
elements have a font of Arial and a font size of 14px.
Using CSS, you can also set other styles of <tr>
elements, such as height, line spacing, etc. Here are some examples:
tr { height: 50px; /* 设置行高为 50 像素 */ line-height: 50px; /* 设置行距为 50 像素 */ padding: 10px; /* 设置内边距为 10 像素 */ }
The above are some common styles for CSS settings <tr>
elements. In actual applications, you can set each <tr>
element individually as needed or add a class name to all <tr>
elements and set the style together.
The above is the detailed content of How to set tr in css. For more information, please follow other related articles on the PHP Chinese website!