3

When you create a basic HTML table everything seems to stay in center of the table. I don't want this how can i stop this from happening?

I wish to use a 2 column html table one for column for a sidebar one for content. Because i have so much content the sidebar text (which is little) gos to the middle of column.

How do i align the text to stay to the top left of the columns?

Shaquille Ray
  • 187
  • 2
  • 3
  • 16

5 Answers5

1

In the <td> element that contains the lefthand sidebar, try specifying a style that aligns text to the top:

<td style="vertical-align: top">(Sidebar HTML code here)</td>

IllvilJa
  • 228
  • 3
  • 10
1

You can control the alignment of columns directly in your markup by using:

<td style="text-align: left; vertical-align: top;"></td>

or even just

<td align="left"></td>

This will work fine for a 2-column table, but Piccolomomo has the better plan if you are going to use it a lot. This might help you further if you need it: http://www.w3schools.com/html/html_tables.asp

Kit Z. Fox
  • 644
  • 1
  • 11
  • 24
0

You can use CSS to change text aligning inside your table:

td {
    text-align: left;
    vertical-align: top;
}
Piccolomomo
  • 58
  • 1
  • 11
0

For aligning text in table you have to use css.Without css or any style sheet you can't make them align.So you can use inline css or external css for that.

<style type="text/css">
table td{
text-align:left;
vertical-align:top;
}
</style>
NewUser
  • 12,713
  • 39
  • 142
  • 236
0
<table>
     <tr valign="top">
        <td align="left">
           Side Bar
        </td>
        <td>
           Content
        </td>
     </tr>
</table>
Lenny Magico
  • 1,183
  • 5
  • 16
  • 28