How to isolate PrimeFaces Widget from being affected by main site CSS


Tags: css,jsf,primefaces,datatable

Problem :

I have a (p:dataTable) Primefaces widget not rendering properly within the templates of the containing main site, presumably affected by higher level global CSS settings which are however mandatory.

Is there a way to isolate the widget from wider scope CSS settings.

I have done the obvious things which is to contain the widget within an IFrames, which works, but creates its own set of problems...



Solution :

There are two solutions to your problem:

  1. Use narrower scopes for global CSS settings. You might have class names that clash, or are shared between other elements on your page and the widget.
  2. Wrap the widget around a container with a specific class/ID, and then override/reset the styles for elements in that container.

    CSS Howto..

    How do I get a floating footer to stick to the bottom of the viewport in IE 6?

    How to align text next to a div?

    How to place two labels around an image (dynamically); right and bottom?

    How to run PHP through Adobe Muse generated CSS

    How to display code blocks with word wrap and line number with jekyll markdown on github-pages

    How do I simplify this header with lines on the side, so that it doesn't need css3 background properties?

    how can I position my img right?

    How to center an element horizontally and vertically?

    How to label ABC in a HTML button and Click events

    How to position a fixed div under another fixed div?

    django render_to_response how to send special characters

    How to modify the orientation of a
      spanning multiple columns?

    How do you run javascript with only a CSS class?

    How to achieve this CSS layout? [closed]

    How can I target and except for the first and last ?

    How to change table cell colour to default on triple click html5/javascript/css

    In CSS how to achieve, two cells with auto width in fixed width parent, with priority to see content in second cell and with ellipsis at first cell?

    How to center align

    CSS: how to stop text from taking up more than 1 line?

    How to correctly set the column widths on my HTML table?

    How to delete first pseudo after

    How to define multiple CSS attributes in JQuery?

    CSS three inline elements with align from left to right, how to occupy all available width

    css - why my text box is not showing up?

    How to indent the text in a custom unordered list

    How do I fix a Wordpress meta box that's blown out by it's content?

    How to ignore css property by override (bootstrap 3)?

    How to create a rounded corner background box using CSS?

    How do you center a line-wrapped

    How to uniformly darken colors?