10

My problem is posted as "solved" here, but apparently I don't understand the solution (?). I have piles of legacy html that appears to be starting to fail in my browser, I dunno why, maybe because of "unsupported" attributes? (Extremely frustrating, by the way. Why eliminate these much simpler attributes that worked fine for decades? I don't give a frickin' rip what anyone thinks of my coding style, as long as it WORKS.)

In particular, I use and the valign doesn't work. So I tried the following, with never a success:

<td align=center vertical-align:top>
<td text-align:center; vertical-align:top>
<td text-align:center; vertical-align:text-top>
<td vertical-align:text-top>

Now I'm only more frustrated. Any suggestions?

Alan K Hunt
  • 117
  • 1
  • 1
  • 3
  • 1
    Isn't the `vertical-align:top` or `vertical-align:text-top` supposed to be in a `style=""`? – s0d4pop Aug 05 '13 at 03:19
  • i think some of them are depreciated a long time ago. – Muhammad Umer Aug 05 '13 at 03:56
  • The title does not correspond to the question at all. The attribute `valign="top"` works, but the attempt at using its CSS counterpart does not work (because of trying to use CSS syntax directly inside HTML). – Jukka K. Korpela Aug 05 '13 at 08:26
  • If the problem is what the title says, then you need to rewrite the question text and provide code sample that uses the HTML `valign` attribute and explain how it fails to work (expected rendering, actual rendering, browser[s] tested). – Jukka K. Korpela Aug 05 '13 at 08:29

3 Answers3

15

The vertical-align:top is not supposed to occur in the td tag itself. You have to put it in a style="" line or in the CSS rules for td.

Using style="":

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

For the CSS method, you will have to give a seperate class or id to each td in order for their styles to be different.

Ernesto Campohermoso
  • 7,213
  • 1
  • 40
  • 51
s0d4pop
  • 532
  • 4
  • 14
1

You can use valign= top not valign: top or vertical-align: top in your html markup and use vertical-align: top; in css

In your html you could do this

<td align=center valign=top>

In your css stylesheet

td{vertical-align: top;}

And in your inline-style

<td align=center style="vertical-align: top;">
Bhojendra Rauniyar
  • 83,432
  • 35
  • 168
  • 231
0

Insted vertical-align:top use valign="top".

Here is your the code:

<td align="center" valign="top">

Note: Never use : in the HTML attributes so instead of using valign:top you should use valign="top"

Idrizi.A
  • 9,819
  • 11
  • 47
  • 88
  • http://www.w3schools.com/tags/att_td_valign.asp says quite opposite. valign attribute is not supported in HTML5. Use CSS instead. – nanosoft Nov 07 '14 at 15:44