html中valign属性如何使用

这篇文章将为大家详细讲解有关html中valign属性如何使用,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

html valign属性的定义和用法:

valign 属性规定单元格中内容的垂直排列方式。

valign属性趋向于垂直对齐,其值包含:top(对内容进行上对齐)、bottom(对内容进行下对齐)、middle(对内容进行居中对齐)、baseline(与基线对齐)

html valign属性的baseline值:

基线是一条虚构的线。在一行文本中,大多数字母以基线为基准。baseline 值设置行中的所有表格数据都分享相同的基线。该值的效果常常与 bottom 值相同。不过,如果文本的字号各不相同,那么 baseline 的效果会更好

html valign属性的语法:

<td valign="value">

HTML <td> 标签的 valign 属性实例

带有不同垂直对齐单元格的表格:

<table border="1">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td valign="top">January</td>
    <td valign="top">$100</td>
  </tr>
  <tr>
    <td valign="bottom">February</td>
    <td valign="bottom">$80</td>
  </tr>
</table>

html5 <td>标签的valign属性的使用方法实例:

<html>
<body>
<table border="1" style="height:200px">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td valign="bottom">January</td>
    <td valign="bottom">$100</td>
  </tr>
  <tr> 
   <td valign="baseline">February</td>
   <td  valign="baseline" style="font-size:200%">$80</td>
  </tr>
</table>
</body>
</html>

HTML<th>标签的valign属性示例:

在下列HTML表格里,不同表头单元格具有不同的垂直对齐方式:

<table border="1" style="height:200px">
  <tr>
    <th valign="middle">月份</th>
    <th valign="bottom">存款</th>
  </tr>
  <tr>
    <td>一月</td>
    <td>100</td>
  </tr>
</table>

HTML<th>标签valign属性的定义及用法:

<th>标签的valign属性用于指出表头单元格中内容的垂直对齐方式。

所有主流浏览器均支持<th>标签的valign属性。

HTML<th>标签valign属性的语法:

<th valign="value">

HTML<th>标签valign属性的属性值:

html中valign属性如何使用

浏览器支持

所有浏览器都支持 valign 属性。

关于html中valign属性如何使用就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。