How to remove border from certain PrimeFaces p: panelGrid?

I find it difficult to remove a border from a specific PrimeFaces <p:panelGrid> .

 <p:panelGrid styleClass="companyHeaderGrid"> <p:row> <p:column> Some tags </p:column> <p:column> Some tags </p:column> </p:row> </p:panelGrid> 

I managed to remove the border from the cells with:

 .companyHeaderGrid td { border: none; } 

But

 .companyHeaderGrid { border: none; } 

Does not work.

+57
css facelets jsf primefaces
May 2 '12 at 20:55
source share
15 answers

The border is set to the generated tr and td elements, and not to table . So this should do:

 .companyHeaderGrid.ui-panelgrid>*>tr, .companyHeaderGrid.ui-panelgrid .ui-panelgrid-cell { border: none; } 

How did I find him? Just check the generated HTML output and all CSS style rules in the webdeveloper toolkit for Chrome (rightclick, Inspect Element or press F12). Firebug and IE9 have a similar set of tools. As for the confusion, just keep in mind that JSF / Facelets ultimately generates HTML and that CSS only applies to HTML markup and not to the JSF source code. Therefore, to use / finetune CSS, you need to search on the client side (web browser).

enter image description here

See also:

  • How to override default PrimeFaces CSS with custom styles?
  • Remove border from all PrimeFaces p: panelGrid components



If you are still on PrimeFaces 4 or older, use below:

 .companyHeaderGrid.ui-panelgrid>*>tr, .companyHeaderGrid.ui-panelgrid>*>tr>td { border: none; } 
+100
May 02 '12 at 21:00
source share
— -

I use Primefaces 6.0 and in order to remove borders from my panel, I use this "ui-noborder" style class as follows:

 <p:panelGrid columns="3" styleClass="ui-noborder"> <!--panel grid contents --> </p:panelGrid> 

It uses a css file called "components" in lib files

+28
Jan 11 '17 at 7:58 on
source share

This worked for me:

 .ui-panelgrid td, .ui-panelgrid tr
 {
     border-style: none! important
 }
+21
Jun 28 '13 at 15:23
source share

If BalusC's answer does not work, try this:

 .companyHeaderGrid td { border-style: hidden !important; } 
+12
Oct 25
source share

If you find a row between columns, use the code below,

 .panelNoBorder, .panelNoBorder tr, .panelNoBorder td{ border: hidden; border-color: white; } 

I checked this with Primefaces 5.1

 <h:head> <title>Login Page</title> <h:outputStylesheet library="css" name="common.css"/> </h:head> <p:panelGrid id="loginPanel" columns="3" styleClass="panelNoBorder"> <p:outputLabel value="Username"/> <p:inputText id="loginTextUsername"/> <p:outputLabel value="Password"/> <p:password id="loginPassword"/> <p:commandButton id="loginButtonLogin" value="Login"/> <p:commandButton id="loginButtonClear" value="Clear"/> </p:panelGrid> 
+4
Oct 26 '14 at 17:11
source share

Primefaces 5.x currently has an attribute in PanelGrid named "columnClasses".

 .no-border { border-style: hidden !important ; /* or none */ } 

So, for a PanelGrid with 2 columns, repeat the CSS class twice.

 <p:panelGrid columns="2" columnClasses="no-border, no-border"> 

For other elements, the ugly “Important!” Is not needed, but for the border, it just works fine for me.

+3
Jan 30 '15 at 22:09
source share

Try

 <p:panelGrid styleClass="ui-noborder"> 
+2
Mar 21 '16 at 5:58
source share

Just add these lines to your own css mycss.css

 table tbody .ui-widget-content { background: none repeat scroll 0 0 #FFFFFF; border: 0 solid #FFFFFF; color: #333333; } 
0
Jul 09 '13 at 10:57
source share

As mentioned by BalusC, PrimeFaces sets the border on the generated tr and td elements, not on the table . However, when you try to use PrimeFaces version 5, there seems to be a more specific match with PrimeFaces CSS .ui-panelgrid .ui-panelgrid-cell > solid , which still leads to black borders when applying the proposed style.

Try using the following style to override Primefaces without using the !important declaration:

 .companyHeaderGrid tr, .companyHeaderGrid td.ui-panelgrid-cell { border: none; } 

As a mention, make sure your CSS is loaded after the PrimeFaces version .

0
May 19 '15 at 8:33
source share

If you just want something simpler, you can just change:

 <p:panelGrid > </p:panelGrid> 

at

 <h:panelGrid border="0"> </h:panelGrid> 

It worked great for me

0
May 9 '16 at 4:57
source share

only the following code works for me

 .noBorder tr { border-width: 0 ; } .ui-panelgrid td{ border-width: 0 } <p:panelGrid id="userFormFields" columns="2" styleClass="noBorder" > </p:panelGrid> 
0
Aug 26 '16 at 16:26
source share

For traditional, as well as for all modern themes to have no border, apply the following:

 <!--No Border on PanelGrid--> <h:outputStylesheet> .ui-panelgrid, .ui-panelgrid td, .ui-panelgrid tr, .ui-panelgrid tbody tr td { border: none !important; border-style: none !important; border-width: 0px !important; } </h:outputStylesheet> 
0
Mar 19 '17 at 9:20
source share

I placed the panel inside the data table, and therefore my working solution

 .ui-datatable-scrollable-body .myStyleClass tbody td{border:none;} 

behind

 <h:panelGrid styleClass="myStyleClass" >...</h:panelGrid> 
0
23 Oct '18 at 8:33
source share

Please try this too

 .ui-panelgrid tr, .ui-panelgrid td { border:0 !important; } 
-one
Jun 11 '14 at 9:48
source share

Use the style modification below to remove the border for the Primefaces switch.

 .ui-selectoneradio td, .ui-selectoneradio tr { border-style: none !important } 
-2
Aug 12 '13 at 6:16
source share



All Articles