bhav27 — 2007-10-26T07:23:28-04:00 — #1
I'm trying to align "middle" <span> tags within <td> vertically. first <span> has following css:
second one has:
first <span> is empty and 2nd one contains text. The text seems to be by default align "middle" but first <span> does valign itself to middle inside <td>.
I have also explicitily set
<span class="fund>some text</span>
but still the result comes out as the one attached image.
Please advice if i'm missing anything in the css to get both <span> tags display in the middle of <td>
paulob — 2007-10-26T09:52:32-04:00 — #2
The vertical align applies to the td (cell) and not the content within the cell itself. It will vertically align the cell with other cells. The content will also be in the middle of the cell but not vertically aligned with respect to other content in that same cell. i.e(the content as whole will be vertically aligned within that cell.)
To vertically align individual elements you would need to put them in separate cells.
<td ><span class="key"></span> </td>
<td><span class="fund">some text</span> </td>
bhav27 — 2007-10-29T06:06:57-04:00 — #3
thanks Paul this works fine now.
autisticcuckoo — 2007-10-29T06:12:56-04:00 — #4
vertical-align property only applies to inline boxes (and table cells). One of your
span classes is using
float:left and the other
display:block, which means neither box is inline anymore. Thus
vertical-align won't apply to them, since they will not be rendered inside a line box.