HTML tr tag

html tr tag

Definition of HTML tr tag

HTML tr tag is used to show HTML table row. A table can contain many numbers of rows. We can define the HTML table row using this tag.


Table can display with rows and columns. Each row can have any number of cells (columns). Let’s explain HTML tr tag with the topics given in the table:


Syntax:

The syntax showing the start and end tr tag to show HTML table row. In each tr tag, there can be any number of table cells.


Table with one row

This is the example showing one row. The example contains the country name with national game.

Output

Name of country with national game:

IndiaHockey

Table with more than one row

This is the example showing more than one row. The example contains the name of players with country name.

Output

Name of cricket players:

NameTeam
Virat KohliIndia
Chris GayleWest Indies
Lasith MalingaSri Lanka
Dwayne BravoWest Indies

List of attributes of HTML tr tag

Sr. No.Attribute NameDescription
1align
  • align the table content to the specified location.
  • The value for this can be:
    • left
    • right
    • center
    • justify
    • char
2bgcolor
  • The bgcolor attribute defines the background color of the table cell.
  • the value for this can be:
    • color name
    • hexcode(eg #ccc)
    • rgb color code (rgb(x, x, x))
3char
  • this attribute can only be use when the value of align attribute is char (align=”char”). This can be useful when you want to specify the character to align.
  • the value for this can be any character.
4charoff
  • Use this attribute only after you specify align=”char”. This defines an alignment offset against the first character.
  • the value for this can be:
    • pixel (eg. 10px)
    • percentage (eg. 2%)
5valign
  • this aligns text vertically in the specified location.
  • the value for this can be:
    • top
    • bottom
    • middle
    • baseline

Resources and References of HTML table row

1. W3C Specification.
2. HTML living standard
3. W3C project using Github


Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.