B
Bigus
Hi
[possible repost - didn't show up last time I posted it]
I want to do the equivalent of a 1-row, 2 column table in CSS, ie: a
coloured bar across the top of the web page with some text aligned to the
left of the bar and an image aligned to the right of the bar.
The tricky bit is that I want it so that if the user increases/decreases the
text size, using their browser, then the text and image remain vertically
centered on the bar.
The nearest I can get to this is with the code:
<div id="thebar">
Some text
<img src="myimage.jpg" width="50" height="30" border="0"
style="position:absolute;right:25px;" />
</div>
The bar expands and contracts with the text and so it remains centered,
however:
a) if you make the text larger the image stays at the top of the bar
b) if you make the text smaller the bar height becomes less than the height
of the image
Specifying a height to the bar stops it getting smaller than the image but
the text no longer vertically centres, and vertical-align: middle doesn't
seem to work in IE, so I cannot think of any solutions for both a) and b)
Any ideas?
[possible repost - didn't show up last time I posted it]
I want to do the equivalent of a 1-row, 2 column table in CSS, ie: a
coloured bar across the top of the web page with some text aligned to the
left of the bar and an image aligned to the right of the bar.
The tricky bit is that I want it so that if the user increases/decreases the
text size, using their browser, then the text and image remain vertically
centered on the bar.
The nearest I can get to this is with the code:
<div id="thebar">
Some text
<img src="myimage.jpg" width="50" height="30" border="0"
style="position:absolute;right:25px;" />
</div>
The bar expands and contracts with the text and so it remains centered,
however:
a) if you make the text larger the image stays at the top of the bar
b) if you make the text smaller the bar height becomes less than the height
of the image
Specifying a height to the bar stops it getting smaller than the image but
the text no longer vertically centres, and vertical-align: middle doesn't
seem to work in IE, so I cannot think of any solutions for both a) and b)
Any ideas?