# How to center a Portal layout component in a div?

gyowanny
283 1 2 6

Hi,

I'm trying to align a portal layout into a div which is my home page. I've already tried several aproaches like Borderlayout and Div, but without any success.
I would like to know if there is a way to put the Portal layout at the center of my screen.

Thanks,

Gyo

delete retag edit

## 3 Replies

twiegand
1807 3

Gyo,

One suggestion might be to try using the <hbox> component with the pack and align attributes.  Something like this:

<zk>
<window height="100%" width="100%">
<div height="100%" width="100%">
<hbox width="100%" height="100%" pack="center" align="center">

Portal layout code here

</hbox>
</div>
</window>
</zk>


The above will center whatever is within the <hbox> both vertically and horizontally.  I do believe you have to set the height / width of the parent components for things to work correctly.

Maybe that will give you a starting point anyway...

Regards,

Todd

gyowanny
283 1 2 6

Thanks Todd,

Will try the suggested approach and then I let you know the results.

Gyo

gyowanny
283 1 2 6

Todd,

That worked fine! Thanks a lot! The simplest solutions sometimes are the hardest ones to figure out.

Cheers,

Gyo

[hide preview]