简体   繁体   中英

How to change width of <p:panelGrid>

I have a <p:panelGrid> as follows:

<p:panelGrid style="width: 50px">
    <p:row>
        <p:column colspan="2">
            <p:inputTextarea/>
        </p:column>
    </p:row>
</p:panelGrid>

I tried to set the width of the panel grid to 50px by setting the CSS width property, however it didn't become 50px wide.

How can I set the width of the panel grid to 50px?

The <p:inputTextarea> is wider than the <p:panelGrid> and therefore pushing it far outside the specified width.

You need to set the width on the <p:inputTextarea> as well.

<p:inputTextarea style="width: 50px;" />

(note: this doesn't take margins into account, so the panel grid is still a bit larger than 50px, but you should now know how to finetune that)


Unrelated to the concrete problem, CSS should go in its own .css file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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