HTML | Tags and Attributes [TABLE] [Formatting] [Cell and Table Alignment & Border Color]



Ü Adjusting cell and table alignment and border color : To adjust the table alignment use the ALIGN attribute between the <TABLE> tag, whose values are LEFT, RIGHT and CENTER.
To align the contents or data of a cell, we will use the ALIGN and VALIGN attributes between the <TH> and <TD> tags. The value of the ALIGN attribute can be LEFT, RIGHT and CENTER. The value of the VALIGN attribute can be TOP, MIDDLE, BOTTOM and BASELINE.
To add color to the borders, use the BORDERCOLOR attribute in the <TABLE> tag. You can also use the BORDERCOLORLIGHT and BORDERCOLORDARK attributes to apply color to the borders. Now, consider the following and its output.
Input :
<HTML><HEAD><TITLE>TABLE</TITLE></HEAD>
<BODY>
Table and cell alignment<BR>
<TABLE BORDERCOLOR=BLACK BORDER=2 WIDTH=50% ALIGN=CENTER>
<TR>
<TD ALIGN=CENTER COLSPAN=2>USA</TD>
</TR>
<TR>
<TD ALIGN=LEFT>New York</TD>
<TD ALIGN=RIGHT>New Jersy</TD>
</TR>
</TABLE> </BODY></HTML>
Output:

Recommended Recommends

Comments

Contact Us