0

How do I get a set of components within a 'center' tag to align horizontally in the center?

asked 2019-04-10 03:44:20 +0800

davout gravatar image davout
1435 3 18

How do I get a set of components within a 'center' tag to align horizontally in the center?

<zk>
    <borderlayout height="70px" >
        <west border="none" >
            <hlayout>
               <image src="/image/home-small.png" width="32px" height="32px" />
                <space />
               <image src="/image/logo-1.png" width="131px" height="36px" />
            </hlayout>
        </west>
        <center border="none" >
            <hbox align="center" pack="center">
                <vbox>
                    <hbox align="center" pack="center" >
                        <a label="Sign up here" href="bbbc.com"/>
                        <space orient="horizontal" width="20px"/>
                        <label value="User id" />
                        <space orient="horizontal" width="10px"/>
                        <textbox cols="20" />
                        <space orient="horizontal" width="15px"/>
                        <label value="Password" />
                        <space orient="horizontal" width="10px"/>
                        <textbox type="password" cols="12"/>
                        <space orient="horizontal" width="15px"/>
                        <button label="Login"/>
                    </hbox>

                </vbox>

            </hbox>

        </center>
        <east border="none" >
            <menubar id="mainMenu" orient="horizontal">
                <menuitem label="Support"/>
                <menu label="Help">
                    <menupopup>
                        <menuitem label="General Help" />
                        <menuitem label="Getting started" />
                        <menuitem label="About (Essays In Software)" />
                        <menuitem label="About (Product)" />
                    </menupopup>
                </menu>

            </menubar>
        </east>
    </borderlayout>
</zk>

The components in the 'center' layout area are aliging to the left. I want them to be centered within the 'center' area

Any suggestions?

delete flag offensive retag edit

2 Answers

Sort by » oldest newest most voted
0

answered 2019-04-10 03:48:16 +0800

davout gravatar image davout
1435 3 18

Solved it...

You have to set the hbox width to 100%

   <center border="none" >
            <hbox align="center" pack="center" width="100%">
link publish delete flag offensive edit
0

answered 2019-04-11 11:39:42 +0800

cor3000 gravatar image cor3000
4466 2 7
ZK Team

or not use hbox/vbox at all, a simpler version would be

http://zkfiddle.org/sample/1ubukk8/2-center-elements

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2019-04-10 03:44:20 +0800

Seen: 5 times

Last updated: Apr 11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More