|
Posted by mardi on 03/21/07 02:31
On Tue, 20 Mar 2007 15:38:49 +0000, Spartaco wrote:
> Hi, this is a big problem for me I can't solve it: I have a <div>, and I
> want the content of this div be vertically aligned in the middle by
> applying CSS styles to the div tag... I've tried the vertical-align but
> it does not work, the content is always at the top.
>
>
Hi, I am but a humble student of the css-fu. I had the same issue arise in
my studies and I did this:
div.container { top: 0; left: 0; width: 100%; height: 100%; position:
fixed; display: table }
div.cell { display: table-cell; vertical-align: middle }
then:
<div class="container">
<div class="cell">
<p>My Content</p>
</div></div>
This works for vertical alignment in the latest versions of Firefox (I
tried it in Linux and MS), Opera (Linux) and Konqueror (obvious :p) but it
does not seem to work in IE 6 & 7.
Navigation:
[Reply to this message]
|