繁体   English   中英

如何垂直对齐按钮

[英]How to align buttons vertically

嗨,大家好,我有几个单选按钮需要垂直放置,但是似乎只能水平放置。

目前,我的代码是:

            <p:panelGrid columns="1">
                <p:selectOneRadio id="options" value="{formBean.number}">  
                    <f:selectItem itemLabel="0 - 19" itemValue="1" /> 
                    <!-- Add in the help button by the side of each item once its lined up, use a grid ?
                    <p:button icon="ui-icon-help" title="Help">  
                    </p:button> -->
                    <f:selectItem itemLabel="20 - 39" itemValue="2" />  
                    <f:selectItem itemLabel="40 - 49" itemValue="4" />  
                    <f:selectItem itemLabel="50 - 59" itemValue="5" />
                    <f:selectItem itemLabel="60 - 69" itemValue="6" />  
                    <f:selectItem itemLabel="70 - 79" itemValue="7" />  
                    <f:selectItem itemLabel="80 - 100" itemValue="8" />  
                </p:selectOneRadio>  
            </p:panelGrid>

我如何将其从水平更改为垂直,我尝试了网格方式,但仍然相同。

多谢你们

编辑

我现在已经实现了我提出的目标:

            <p:panelGrid columns="1">
                <p:selectOneRadio id="options" value="{formBean.number}" layout="grid" columns="1" required = "True"
                              requiredMessage="#{bundle.requiredGender}"> 
                    <f:selectItem itemLabel="0 - 19" itemValue="1" /> 

                    <f:selectItem itemLabel="20 - 39" itemValue="2" />  
                    <f:selectItem itemLabel="40 - 49" itemValue="4" />  
                    <f:selectItem itemLabel="50 - 59" itemValue="5" />
                    <f:selectItem itemLabel="60 - 69" itemValue="6" />  
                    <f:selectItem itemLabel="70 - 79" itemValue="7" />  
                    <f:selectItem itemLabel="80 - 100" itemValue="8" />  
                </p:selectOneRadio>  
            </p:panelGrid>

唯一的问题是,现在网格是页面的大小,以任何方式可以将页面向左对齐并仅设置标签的大小?

使用p:selectOneRadio上的layout属性,其值为pageDirection

这是layout可能值:

  • lineDirection水平方向
  • pageDirection用于垂直方向。
  • grid -用于网格图案
  • pageDirection用于垂直方向。
  • responsive -用于动态使用提供的空间
  • custom用于自定义布局。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM