简体   繁体   English

ap:column保持ap:panelGrid内部的右对齐

[英]Right alignment inside a p:column holding a p:panelGrid

Given the following <p:panelGrid> . 给定以下<p:panelGrid>

<p:panelGrid style="width: 25%;">
    <p:row>
        <p:column style="text-align: right;">
            a
        </p:column>
    </p:row>
</p:panelGrid>

The text inside <p:column> is aligned right as can be seen below. 如下所示, <p:column>内的文本右对齐。

在此处输入图片说明

I need to display another <p:panelGrid> inside that <p:column> as follows. 我需要在该<p:column>显示另一个<p:panelGrid> ,如下所示。

<p:panelGrid style="width: 25%;">
    <p:row>
        <p:column style="text-align: right;">
            <p:panelGrid>
                <p:row>
                    <p:column>
                        b
                    </p:column>
                </p:row>
            </p:panelGrid>
        </p:column>
    </p:row>
</p:panelGrid>

The style attribute text-align: right; 样式属性text-align: right; of <p:column> has no effect in this case. <p:column>情况在这种情况下不起作用。

在此处输入图片说明

How to align the inner <p:panelGrid> right? 如何将内部<p:panelGrid>对齐?

Since the panelGrid is a table you can float it to the right: 由于panelGrid是一个表,因此您可以将其浮动到右侧:

 <p:panelGrid style="width: 25%;">
    <p:row>
       <p:column>
           <p:panelGrid style="float: right">
               <p:row>
                   <p:column>
                       b
                   </p:column>
               </p:row>
           </p:panelGrid>
       </p:column>
   </p:row>
 </p:panelGrid>

在内部面板网格上应用样式

<p:panelGrid style="text-align: right; display:inline-block">

Add class for the panel and apply the styles like below. 为面板添加类,然后应用以下样式。

 <p:panelGrid style="width: 25%;" styleClass="mytest">
 <p:row>
    <p:column>
        <p:panelGrid>
            <p:row>
                <p:column>
                    b
                </p:column>
            </p:row>
        </p:panelGrid>
    </p:column>
 </p:row>
</p:panelGrid>

CSS CSS

.mytest td
{
  text-align:right;
}

If not work then try the below. 如果不起作用,请尝试以下方法。

.mytest td
{
  float:right;
}

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

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