![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Vertical-Align is not working in IE 7. Is there another way to align an image vertically? Code Below: style type="text/css" IMG.displayed { display: block; margin-left: auto; margin-right: auto; vertical-align: middle } /style /head body style="background-color:#d5ceca" <img class="displayed" alt="" longdesc="" src="out.jpg" width="792" height="612" /></td /body |
#3
| |||
| |||
|
|
On 2008-02-06, BillGatesFan <klj_m... (AT) hotmail (DOT) com> wrote: Vertical-Align is not working in IE 7. Is there another way to align an image vertically? Code Below: style type="text/css" IMG.displayed { * * display: block; * * margin-left: auto; * * margin-right: auto; * * vertical-align: middle * * } /style /head body style="background-color:#d5ceca" * * * * * *<img class="displayed" alt="" longdesc="" src="out.jpg" width="792" height="612" /></td /body If your image is really in a <td>, then set vertical-align: middle on the <td>, not on the img. Vertical-align on an element that's display: block like your image means nothing. You can set vertical-align on table-cells or on inline elements, and it means very different things. You probably want the table-cell one. The HTML you've posted is obviously completely invalid by the way and I assume not what you're really using!- Hide quoted text - - Show quoted text - |
#4
| |||
| |||
|
|
On Feb 6, 5:13*pm, Ben C <spams... (AT) spam (DOT) eggs> wrote: [...] Vertical-Align is not working in IE 7. Is there another way to align an image vertically? style type="text/css" IMG.displayed { * * display: block; * * margin-left: auto; * * margin-right: auto; * * vertical-align: middle * * } /style /head [...] If your image is really in a <td>, then set vertical-align: middle on the <td>, not on the img. [...] This does not work either. table style="width: 100%" <tr <td style="vertical-align:middle" <img alt="" longdesc="" src="out.jpg" width="792" height="612" /></ td </tr </table |
#5
| |||
| |||
|
|
On 2008-02-07, BillGatesFan <klj_m... (AT) hotmail (DOT) com> wrote: On Feb 6, 5:13*pm, Ben C <spams... (AT) spam (DOT) eggs> wrote: [...] Vertical-Align is not working in IE 7. Is there another way to align an image vertically? style type="text/css" IMG.displayed { * * display: block; * * margin-left: auto; * * margin-right: auto; * * vertical-align: middle * * } /style /head [...] If your image is really in a <td>, then set vertical-align: middle on the <td>, not on the img. [...] This does not work either. table style="width: 100%" * * * * * * * * * *<tr * * * * * * * * * * * * * *<td style="vertical-align:middle" * * * * * *<img *alt="" longdesc="" src="out.jpg" width="792" height="612" /></ td * * * * * * * * * *</tr * * * * * *</table Well with this example, the td is going to be no higher than the img anyway, so vertical-align is academic. What exactly do you expect to happen?- Hide quoted text - - Show quoted text - |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
On Feb 7, 10:37*am, Ben C <spams... (AT) spam (DOT) eggs> wrote: On 2008-02-07, BillGatesFan <klj_m... (AT) hotmail (DOT) com> wrote: [...] On Feb 6, 5:13*pm, Ben C <spams... (AT) spam (DOT) eggs> wrote: [...] Vertical-Align is not working in IE 7. Is there another way to align an image vertically? style type="text/css" IMG.displayed { * * display: block; * * margin-left: auto; * * margin-right: auto; * * vertical-align: middle * * } /style /head [...] If your image is really in a <td>, then set vertical-align: middle on the <td>, not on the img. [...] This does not work either. table style="width: 100%" * * * * * * * * * *<tr * * * * * * * * * * * * * *<td style="vertical-align:middle" * * * * * *<img *alt="" longdesc="" src="out.jpg" width="792" height="612" /></ td * * * * * * * * * *</tr * * * * * *</table Well with this example, the td is going to be no higher than the img anyway, so vertical-align is academic. What exactly do you expect to happen?- Hide quoted text - - Show quoted text - I was expecting the table to span the whole page and not just the image. |
|
So if I vertical-aligned the image it will show in the middle of the page. |
#8
| |||
| |||
|
|
On 2008-02-07, BillGatesFan <klj_m... (AT) hotmail (DOT) com> wrote: On Feb 7, 10:37*am, Ben C <spams... (AT) spam (DOT) eggs> wrote: On 2008-02-07, BillGatesFan <klj_m... (AT) hotmail (DOT) com> wrote: [...] On Feb 6, 5:13*pm, Ben C <spams... (AT) spam (DOT) eggs> wrote: [...] Vertical-Align is not working in IE 7. Is there another way to align an image vertically? style type="text/css" IMG.displayed { * * display: block; * * margin-left: auto; * * margin-right: auto; * * vertical-align: middle * * } /style /head [...] If your image is really in a <td>, then set vertical-align: middle on the <td>, not on the img. [...] This does not work either. table style="width: 100%" * * * * * * * * * *<tr * * * * * * * * * * * * * *<td style="vertical-align:middle" * * * * * *<img *alt="" longdesc="" src="out.jpg"width="792" height="612" /></ td * * * * * * * * * *</tr * * * * * *</table Well with this example, the td is going to be no higher than the img anyway, so vertical-align is academic. What exactly do you expect to happen?- Hide quoted text - - Show quoted text - I was expecting the table to span the whole page and not just the image. It does span the whole page horizontally, because you set width: 100%. So if I vertical-aligned the image it will show in the middle of the page. Vertical-align aligns things vertically. But your table spans the page horizontally. I'm sorry if I took for granted that you had a basic grasp of the concept of two-dimensional space. Perhaps you want * * html, body, table { height: 100% } Together with vertical-align: middle on the td that should put the image in the middle of the page vertically. If you also want the image in the middle horizontally, then don't set width: 100% on the table, but do set margin: 0 auto on it.- Hide quoted text - - Show quoted text - |
#9
| |||
| |||
|
|
On Feb 7, 11:48*am, Ben C <spams... (AT) spam (DOT) eggs> wrote: On 2008-02-07, BillGatesFan <klj_m... (AT) hotmail (DOT) com> wrote: [...] Vertical-Align is not working in IE 7. Is there another way to align [...] If your image is really in a <td>, then set vertical-align: middle on the <td>, not on the img. [...] This does not work either. [...] What exactly do you expect to happen?- Hide quoted text - [...] I was expecting the table to span the whole page and not just the image. It does span the whole page horizontally, because you set width: 100%. So if I vertical-aligned the image it will show in the middle of the page. Vertical-align aligns things vertically. But your table spans the page horizontally. I'm sorry if I took for granted that you had a basic grasp of the concept of two-dimensional space. [...] Still did not work. lol |
![]() |
| Thread Tools | |
| Display Modes | |
| |