加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

valign与HTML中的text-align

发布时间:2020-12-14 23:32:09 所属栏目:资源 来源:网络整理
导读:我无法通过以下代码弄清楚上下文中的valign与text-align之间的区别: table width="500" border="0" tr td colspan="2" style="background-color:#FFA500;" h1Main Title of Web Page/h1 /td /tr tr valign="top" td style="background-color:#FFD700;width:
我无法通过以下代码弄清楚上下文中的valign与text-align之间的区别:
<table width="500" border="0">
  <tr>
        <td colspan="2" style="background-color:#FFA500;">
   <h1>Main Title of Web Page</h1>
   </td>
      </tr>

  <tr valign="top">
      <td style="background-color:#FFD700;width:100px;text-align:top;">
      <b>Menu</b><br />
    HTML<br />
      CSS<br />
  JavaScript
     </td>
   <td style="background-color:#EEEEEE;height:200px;width:400px;text-align:top;">
      Content goes here</td>
    </tr>

   <tr>
     <td colspan="2" style="background-color:#FFA500;text-align:center;">
     Copyright ? 2012</td>
   </tr>
   </table>

解决方法

text-align的正确值是水平的,而valign是垂直的,因此它是top | middle | bottom | baseline.您也可以在两者上使用inherit.

另外,text-align是css,而valign是html属性.我认为align是与text-align相当的html,而vertical-align相当于valign.

http://www.w3schools.com/cssref/pr_text_text-align.asp

http://www.w3schools.com/tags/att_td_valign.asp

如果将text-align切换为“bottom”,您会注意到它不会移动,因为bottom对text-align无效.默认(我认为)是最高的.如果你把“vertical-align:bottom”放在底部,那么它将会显示在底部.

一个简单的网络搜索会找到你这些答案……

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读