Css f:selectItems for p:selectOneRadio未正确对齐

Css f:selectItems for p:selectOneRadio未正确对齐,css,jsf,primefaces,radio-button,Css,Jsf,Primefaces,Radio Button,下面是我正在使用的代码 <p:panel id="panel" styleClass="panelWidth" header="Please answer the following Questions " > <h:panelGrid cellpadding="5" > <p:selectOneRadio value="#{sendingRequest.selectedAnser1}" layout="pageDirection" sty

下面是我正在使用的代码

 <p:panel id="panel" styleClass="panelWidth" header="Please answer the following Questions " >
            <h:panelGrid cellpadding="5" >
<p:selectOneRadio value="#{sendingRequest.selectedAnser1}" layout="pageDirection" styleClass="questionsFont">

                        <f:selectItems value="#{sendingRequest.questionChoices2}"/>

<p:selectOneRadio value="#{sendingRequest.selectedAnser2}" layout="pageDirection" styleClass="questionsFont">

                        <f:selectItems value="#{sendingRequest.questionChoices3}"  />
                    </p:selectOneRadio>


但在我的前端页面中,单选按钮显示在面板的左侧,选项显示在面板的中心。

我怀疑您提供的输入模板可能是问题所在,因为我看到您正在使用自定义布局标记。通过将Primefaces SelectOneRadio页面中的任何示例插入到当前页面,查看是否得到相同的结果,来研究此场景

我关闭了您提供的代码的标记,并给出了一个Primefaces示例,您可以暂时将其合并到代码中,以便检查这两个示例

<!-- Primefaces Example -->
<h:form>
    <h3 style="margin-top:0">Basic</h3>
    <h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">
        <p:outputLabel for="console" value="Console:"/>
        <p:selectOneRadio id="console" value="#{radioView.console}">
            <f:selectItem itemLabel="Xbox One" itemValue="Xbox One"/>
            <f:selectItem itemLabel="PS4" itemValue="PS4"/>
            <f:selectItem itemLabel="Wii U" itemValue="Wii U"/>
        </p:selectOneRadio>
    </h:panelGrid>
</h:form>

<!-- Your Example (with closed off tags)-->
<h:form>
    <p:panel id="panel" styleClass="panelWidth" header="Please answer the following Questions ">
        <h:panelGrid cellpadding="5">
            <p:selectOneRadio value="#{sendingRequest.selectedAnser1}" layout="pageDirection"
                              styleClass="questionsFont">
                <f:selectItems value="#{sendingRequest.questionChoices2}"/>
            </p:selectOneRadio>
            <p:selectOneRadio value="#{sendingRequest.selectedAnser2}" layout="pageDirection"
                              styleClass="questionsFont">
                <f:selectItems value="#{sendingRequest.questionChoices3}"/>
            </p:selectOneRadio>
        </h:panelGrid>
    </p:panel>
</h:form>

基本的

如果它确实与样式相关,请发布您当前使用的CSS。祝你好运

关闭你的标签,如果你希望有人能帮助你的话,可能会以更可读的方式展示它。使用正确的标签(java(se)?但没有css?),查看生成的html客户端,尝试分析它,并在此处查找原因开始:然后