开发者

I want to align the text in a <td> to the top

I have the following code

<table style="height: 275px; width: 188px">
    <tr>
      开发者_如何转开发  <td style="width: 259px;">
            main page
        </td>
    </tr>
</table>

The main page appears in the center of the cell I want it to appear at the top.


https://developer.mozilla.org/en/CSS/vertical-align

<table style="height: 275px; width: 188px">
    <tr>
        <td style="width: 259px; vertical-align:top">
            main page
        </td>
    </tr>
</table>

?


Add a vertical-align property to the TD, like this:

<td style="width: 259px; vertical-align: top;">
main page
</td>


Use <td valign="top" style="width: 259px"> instead...


I was facing such a problem, look at the picture below

I want to align the text in a <td> to the top

and here is its HTML

<tr class="li1">
    <td valign="top">1.</td>
    <td colspan="5" valign="top">
        <p>How to build e-book learning environment</p>
    </td>
</tr>

so I fix it by changing valign Attribute in both td tags to baseline

and it worked

here is the result

I want to align the text in a <td> to the top

hope this help you


you can use valign="top" on the td tag it is working perfectly for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜