Vertical centering in html is not that simple. Search the web for 'css
vertical centering' to see how to do this.

For horizontal centering part, this should do the trick:

<html>
<body style="width:100%">
    <div style="margin-left:auto;margin-right:auto;border:1px solid
black;width:50%;padding:5pt;">
        test centered<br/>on several <br/>lines
        <div style="width:100%;background:blue;color:red">This is on
blue background</div>
    </div>
</body>
</html>

important part are the auto margin and the fixed width (in percentage).
If you don't do this, div will use maximum size.
Yuri Ivanov a écrit :
>
> Hello,
>
> I have simple layout task. I need to make a login dialog box in the
> center of the browser screen.  The problem that initial size of the
> page I need to set in px, and it’s not good.
>
> I have tried to set page width and height to 100%, but it doesn’t work.
>
>   <tc:page width="100%" height="100%">
>
>   <!-- width="1000px" height="700px" -->
>
>     <f:facet name="layout">
>
>       <tc:gridLayout rows="30%;fixed;30%" columns="30%;*;30%"  />
>
>     </f:facet>
>
>       <tc:cell spanX="1" spanY="2"/>
>
> …
>
>  
>
> What is the best solution of this simple layout task?
>
>  
>
>  
>
> Thanks,
>
> Yuri Ivanov.
>
>  
>

Reply via email to