Jump to content


vertical alignment


11 replies to this topic

#1 fayt

    Young Padawan

  • Members
  • Pip
  • 88 posts
  • Location:derry
  • Interests:you ;)

Posted 12 July 2006 - 02:22 PM

hello all,

i was wondering if anyone would be able to tell me to how vertically align a table. I know how to align horizontally but i am confused on how to do it vertically.

thanks :)

#2 Matthew.

    Official Spammer .Matt

  • Members
  • PipPipPipPip
  • 2,749 posts
  • Gender:Male
  • Location:England

Posted 12 July 2006 - 02:28 PM

If your using a table, its a simple matter of adding:

valign="middle"
:)

#3 fayt

    Young Padawan

  • Members
  • Pip
  • 88 posts
  • Location:derry
  • Interests:you ;)

Posted 12 July 2006 - 03:27 PM

thanks for the reply. i tried that before i posted but it didnt do anything :(

#4 Matthew.

    Official Spammer .Matt

  • Members
  • PipPipPipPip
  • 2,749 posts
  • Gender:Male
  • Location:England

Posted 12 July 2006 - 03:31 PM

Are you applying it to the table or the TD?

I don't use tables, so i don't remember if it works on the <table> tag or just <td>.

#5 fayt

    Young Padawan

  • Members
  • Pip
  • 88 posts
  • Location:derry
  • Interests:you ;)

Posted 12 July 2006 - 03:34 PM

i tried it on the <table> tag but i shall try it on the <td> now

edit: nope didnt work for either :s

Edited by fayt, 12 July 2006 - 03:38 PM.


#6 fayt

    Young Padawan

  • Members
  • Pip
  • 88 posts
  • Location:derry
  • Interests:you ;)

Posted 12 July 2006 - 03:43 PM

ok im confused, align="center" works for the <table> tag but valign wont work :S

#7 Matthew.

    Official Spammer .Matt

  • Members
  • PipPipPipPip
  • 2,749 posts
  • Gender:Male
  • Location:England

Posted 12 July 2006 - 03:54 PM

ok, look at this:

<table width="100%" border="1" >

  <tr>
	<td>1<br /><br /><br /></td> <td valign="top">2</td> <td colspan="2" valign="bottom"> 3 

and 4</td>
  </tr>

  <tr>
	<td>1</td> <td>2</td> <td>3</td> <td>4</td>
  </tr>

</table>

Note where the valigns are.

#8 fayt

    Young Padawan

  • Members
  • Pip
  • 88 posts
  • Location:derry
  • Interests:you ;)

Posted 12 July 2006 - 04:04 PM

if i use valign within the <td> tags it only aligns the text within in, if i use it within the <table> tag, it does nothing :S

any css methods to vertically align the whole table?

#9 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 972 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 12 July 2006 - 09:37 PM

vertical-align:top;

I've always had trouble getting vertical-aligns to work with Firefox, or even IE in most cases. So, I usually cheat and use this.
line-height:*px;

I then debug and figure what to use as the *. Very unconventional, but it always works for me.

#10 coolaid

    P2L Jedi Master

  • Members
  • PipPipPipPip
  • 1,435 posts
  • Gender:Male
  • Interests:i wonder..

Posted 12 July 2006 - 09:43 PM

View PostDemonslay, on Jul 13 2006, 02:36 AM, said:

line-height:*px;

I then debug and figure what to use as the *. Very unconventional, but it always works for me.

thats not unconventional, i use it all the time (give a tag a width, give the line-height the same width) - but it only works on single lined tags.

anyway, theres no good way to vertically align site layout which i think your trying to do? want to align something else vertically, use a table with valign=""

#11 Misael

    Young Padawan

  • Members
  • Pip
  • 2 posts

Posted 13 July 2006 - 12:43 AM

View Postfayt, on Jul 12 2006, 11:03 PM, said:

if i use valign within the <td> tags it only aligns the text within in, if i use it within the <table> tag, it does nothing :S

any css methods to vertically align the whole table?

For this you need to use a table in a table

<table width="100%" height="100%">
 <tr>
  <td align="center" valign="center">
  <table width="200" height="200">
   <tr>
	<td align="center">Here's your tekst</td>
   </tr>
  </table>
  </td>
 </tr>
</table>

By the way, using a lot of tables will make the loading time longer, so try using CSS.

#12 fayt

    Young Padawan

  • Members
  • Pip
  • 88 posts
  • Location:derry
  • Interests:you ;)

Posted 13 July 2006 - 09:37 AM

thanks for all the help :biggrin:





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users