From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/html/element/tr/index.html | 249 +++++++++++++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 files/zh-cn/web/html/element/tr/index.html (limited to 'files/zh-cn/web/html/element/tr') diff --git a/files/zh-cn/web/html/element/tr/index.html b/files/zh-cn/web/html/element/tr/index.html new file mode 100644 index 0000000000..a7b41a75d4 --- /dev/null +++ b/files/zh-cn/web/html/element/tr/index.html @@ -0,0 +1,249 @@ +--- +title: +slug: Web/HTML/Element/tr +translation_of: Web/HTML/Element/tr +--- +

HTML <tr> 元素定义表格中的行。 Those can be a mix of {{HTMLElement("td")}} and {{HTMLElement("th")}} elements.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Content categoriesNone
Permitted contentZero or more {{HTMLElement("td")}} or {{HTMLElement("th")}} elements, or a mix of them
Tag omissionStart tag is mandatory. End tag may be omitted if the {{HTMLElement("tr")}} element is immediately followed by a {{HTMLElement("tr")}} element, or if the parent table group ({{HTMLElement("thead")}}, {{HTMLElement("tbody")}} or {{HTMLElement("tfoot")}}) element doesn't have any more content
Permitted parents{{HTMLElement("table")}}, {{HTMLElement("thead")}}, {{HTMLElement("tbody")}} or {{HTMLElement("tfoot")}} element
Permitted ARIA rolesAny
DOM interface{{domxref("HTMLTableRowElement")}}
+ +

Attributes

+ +

表格标签支持 全局特性。还有一些过期的特性,你应该避免使用它们,但是可以了解它们,会在你阅读旧代码的时候有所帮助。

+ +
+
{{htmlattrdef("align")}} {{deprecatedGeneric("inline","html4.01")}}, {{obsoleteGeneric("inline","html5")}}
+
This enumerated attribute specifies how horizontal alignment of each cell content will be handled. Possible values are: +
    +
  • left, aligning the content to the left of the cells
  • +
  • center, centering the content in the cells
  • +
  • right, aligning the content to the right of the cells
  • +
  • justify, widening the spaces in the textual content so that the content is justified in the cells
  • +
  • char, aligning the textual content on a special character with a minimal offset, defined by the {{htmlattrxref("char", "tr")}} and {{htmlattrxref("charoff", "tr")}} attributes {{unimplemented_inline("2212")}}
  • +
+ +

If this attribute is not set, the parent node's value is inherited.

+ +
Note: Do not use this attribute as it is obsolete (not supported) in the latest standard. + +
    +
  • To achieve the same effect as the left, center, right or justify values, use the CSS {{cssxref("text-align")}} property on it.
  • +
  • To achieve the same effect as the char value, in CSS3, you can use the value of the {{htmlattrxref("char", "tr")}} as the value of the {{cssxref("text-align")}} property {{unimplemented_inline}}.
  • +
+
+
+
+ +
+
{{htmlattrdef("bgcolor")}} {{deprecatedGeneric("inline","html4.01")}}, {{obsoleteGeneric("inline","html5")}}
+
This attribute defines the background color of each cell of the row. It can be either an hexadecimal #RRGGBB or #RGB value or a color keyword. +
Usage note: the {{HTMLElement("tr")}} element should be styled using CSS. To give a similar effect to the bgcolor attribute, use the CSS property {{cssxref("background-color")}}.
+
+
+ +
+
{{htmlattrdef("char")}} {{deprecatedGeneric("inline","html4.01")}}, {{obsoleteGeneric("inline","html5")}}
+
This attribute is used to set the character to align the cells in a column on. Typical values for this include a period (.) when attempting to align numbers or monetary values. If {{htmlattrxref("align", "tr")}} is not set to char, this attribute is ignored. +
Note: Do not use this attribute as it is obsolete (and not supported) in the latest standard. To achieve the same effect as the {{htmlattrxref("char", "tr")}}, in CSS3, you can use the character set using the {{htmlattrxref("char", "tr")}} attribute as the value of the {{cssxref("text-align")}} property {{unimplemented_inline}}.
+
+
+ +
+
{{htmlattrdef("charoff")}} {{deprecatedGeneric("inline","html4.01")}}, {{obsoleteGeneric("inline","html5")}}
+
This attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char attribute. +
Note: Do not use this attribute as it is obsolete (and not supported) in the latest standard.
+
+
+ +
+
{{htmlattrdef("valign")}} {{deprecatedGeneric("inline","html4.01")}}, {{obsoleteGeneric("inline","html5")}}
+
This attribute specifies the vertical alignment of the text within each row of cells of the table header. Possible values for this attribute are: +
    +
  • baseline, which will put the text as close to the bottom of the cell as it is possible, but align it on the baseline of the characters instead of the bottom of them. If characters are all of the size, this has the same effect as bottom.
  • +
  • bottom, which will put the text as close to the bottom of the cell as it is possible;
  • +
  • middle, which will center the text in the cell;
  • +
  • and top, which will put the text as close to the top of the cell as it is possible.
  • +
+ +
Note: Do not use this attribute as it is obsolete (and not supported) in the latest standard: instead set the CSS {{cssxref("vertical-align")}} property on it.
+
+
+ +

Examples

+ +

See {{HTMLElement("table")}} for examples on <tr>.

+ +

Specifications

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG','tables.html#the-tr-element','tr element')}}{{Spec2('HTML WHATWG')}} 
{{SpecName('HTML5 W3C','tabular-data.html#the-tr-element','tr element')}}{{Spec2('HTML5 W3C')}} 
+ +

Browser compatibility

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support1.0{{CompatVersionUnknown}}{{CompatGeckoDesktop("1.0")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
align/valign attribute1.0{{CompatVersionUnknown}}{{CompatNo}} [1]{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
char/charoff attribute1.0{{CompatVersionUnknown}}{{CompatNo}} [2]{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
bgcolor attribute {{Non-standard_inline}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatVersionUnknown}}{{CompatNo}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidEdgeFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoMobile("1.0")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
align/valign attribute{{CompatUnknown}}{{CompatVersionUnknown}}{{CompatNo}} [1]{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
char/charoff attribute{{CompatUnknown}}{{CompatVersionUnknown}}{{CompatNo}} [2]{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
bgcolor attribute {{Non-standard_inline}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatVersionUnknown}}{{CompatNo}}{{CompatNo}}
+
+ +

[1] See {{bug(915)}}.

+ +

[2] See {{bug(2212)}}.

+ +

See also

+ + + +

{{HTMLRef}}

-- cgit v1.2.3-54-g00ecf