...

View Full Version : A text postition in a table cell



gamehack
01-27-2004, 03:26 PM
How can I center a text in a cell ? But not to center in from the left and right but from the top and the bottom ? For example if I have Verdane font with size 1 and the cell is 14px and I want it to be in center from the top and the bottom :)
Thanks to all

LeeTzeR
01-27-2004, 04:13 PM
i am not 100% sure but i thought it was valign="midle"

squirellplaying
01-27-2004, 04:34 PM
Yes, it is valign="middle"

gamehack
01-27-2004, 04:51 PM
thanks...

J&J
01-27-2004, 09:31 PM
To center vertically within a table cell, sentence, a line/group of images, etc. use
valign=" ".
The options to enclose in quotes are: top, middle, bottom.

me'
01-28-2004, 10:57 PM
Shame CSS has no well supported alternative, this is presentational markup.

Roy Sinclair
01-28-2004, 11:15 PM
Originally posted by me'
Shame CSS has no well supported alternative, this is presentational markup.

vertical-align: middle; --- You mean this CSS doesn't work?

welo
01-29-2004, 08:44 AM
As long as you don't specify valign="", whatever you put in a <td> will automatically default to the middle vertical position anyway.

liorean
01-29-2004, 11:56 AM
Originally posted by Roy Sinclair
vertical-align: middle; --- You mean this CSS doesn't work? It works, but it doesn't do the same thing. vertical-align aligns inline elements to different positions in the linebox, not box elements to different positions in the box.

'vertical-align'
Property name: 'vertical-align'
Value: baseline | sub | super | top | text-top | middle | bottom | text-bottom | <percentage> | <length> | inherit
Initial: baseline
Applies to: inline elements
Inherited: no
Percentage values: refer to the 'line-height' of the element itself
Media groups: visual

This property affects the vertical positioning inside a line box of the boxes generated by an inline element. The following values only have meaning with respect to a parent inline element; they have no effect if no parent exists:

'baseline'
Align the baseline of text in the box with the baseline of text in the parent box. If the box doesn't contain text, align the bottom of the box with the parent's baseline.
'middle'
Align the vertical midpoint of the box with the baseline of text in the parent box plus half the x-height of the parent.
'sub'
Subscript the box. This value has no effect on the font size of the element's text.
'super'
Superscript the element. This value has no effect on the font size of the element's text.
'text-top'
Align the top of the box with the top of the parent element's font
'text-bottom'
Align the bottom of the box with the bottom of the parent element's font

The remaining values refer to the line box in which the generated box appears:

'top'
Align the top of the box with the top of the line box.
'bottom'
Align the bottom of the box with the bottom of the line box.

Roy Sinclair
01-29-2004, 05:54 PM
Originally posted by liorean
It works, but it doesn't do the same thing. vertical-align aligns inline elements to different positions in the linebox, not box elements to different positions in the box.

Note that it also effects "table cell elements" per http://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align.

The source you quoted is incomplete.

liorean
01-29-2004, 05:59 PM
Hmm, seems like the version of CSS2 that I have on my harddrive is an earlier draft. That change had not been made then.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum