FlexGrid

Flex Grid CSS is a lightweight flex based responsive layout utility optimized for mobile phones, tablets and desktops. Flex Grid CSS is not included in PrimeFaces as it is provided by PrimeFlex, a shared grid library between PrimeFaces, PrimeNG and PrimeReact projects.

Basic

1
2
3

Dynamic

1
2
3
4
5
6

Reverse Direction

1
2
3

Column Direction

1
2
3

Reverse Column Direction

1
2
3

12 Column Grid

4
1
1
1
1
1
1
1
1
2
6
4
8
2
2

MultiLine

6
6
6
6

Fixed Width Column

100px
auto

Responsive

p-col-12 p-md-6 p-lg-3
p-col-12 p-md-6 p-lg-3
p-col-12 p-md-6 p-lg-3
p-col-12 p-md-6 p-lg-3

Horizontal Alignment - Start

2
1
4

Horizontal Alignment - End

2
1
4

Horizontal Alignment - Center

2
1
4

Horizontal Alignment - Between

2
1
4

Horizontal Alignment - Around

2
1
4

Horizontal Alignment - Even

2
1
4

Vertical Alignment - Start

4
4
4

Vertical Alignment - End

4
4
4

Vertical Alignment - Center

4
4
4

Vertical Alignment - Stretch

4
4
4

Vertical Alignment - Per Column

4
4
4

Offset

6
4
4

Nested

6
6
12
4

Panel Integration

GodFather
The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding. His beloved son Michael has just come home from the war, but does not intend to become part of his father's business. Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family.
GodFather
The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding. His beloved son Michael has just come home from the war, but does not intend to become part of his father's business. Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family.
GodFather
The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding. His beloved son Michael has just come home from the war, but does not intend to become part of his father's business. Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family.

Sample Layout

Menu
Top Bar
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet, orci nec dictum convallis, ligula mauris vestibulum turpis, nec varius tortor quam at diam. Nullam a viverra nibh. In tincidunt tempor lectus quis vulputate. Pellentesque nec dui aliquam, lobortis est in, lobortis ante
Maecenas vel nisi aliquet, vulputate tortor id, laoreet massa. Maecenas mattis tristique bibendum. Suspendisse vel mi dictum, vestibulum lacus quis, pulvinar quam. Proin vulputate, nibh at finibus varius, leo eros lacinia elit, nec blandit odio tellus a justo. Donec nec ex auctor, tristique nulla nec, rutrum sapien.
Proin efficitur in leo eget ornare. Nam vestibulum neque sed velit sagittis sodales. Sed scelerisque hendrerit magna a hendrerit. Cras tempor sem at justo pharetra convallis. Curabitur vel sodales purus. Vestibulum interdum facilisis nulla imperdiet suscipit. Quisque lectus felis, condimentum eget hendrerit sit amet.
Phasellus faucibus purus volutpat mauris lacinia sodales. Ut sit amet sapien facilisis, commodo dui non, fringilla tellus. Quisque tempus facilisis nisi sodales finibus. Pellentesque neque orci, ullamcorper vitae ligula quis, dignissim euismod augue.
Fusce ullamcorper congue massa, eget ullamcorper nunc lobortis egestas. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ultrices dui eget dolor feugiat dapibus. Aliquam pretium leo et egestas luctus. Nunc facilisis gravida tellus.
Footer
 
<h3 class="first">Basic</h3>
<div class="p-grid">
    <div class="p-col">
        <div class="box">1</div>
    </div>
    <div class="p-col">
        <div class="box">2</div>
    </div>
    <div class="p-col">
        <div class="box">3</div>
    </div>
</div>

<h3>Dynamic</h3>
<h:form>
    <p:commandButton icon="pi pi-plus" action="#{flexGridView.increment}" update="output" />
    <p:commandButton icon="pi pi-minus" action="#{flexGridView.decrease}" update="output" />

    <p:outputPanel id="output">
        <div class="p-grid" style="margin-top: .5em">
            <ui:repeat var="column" value="[1, 2, 3, 4, 5, 6]">
                <div class="p-col">
                    <div class="box">
                        #{column}
                    </div>
                </div>
            </ui:repeat>
        </div>
    </p:outputPanel>
</h:form>

<h3>Reverse Direction</h3>
<div class="p-grid p-dir-rev">
    <div class="p-col">
        <div class="box">1</div>
    </div>
    <div class="p-col">
        <div class="box">2</div>
    </div>
    <div class="p-col">
        <div class="box">3</div>
    </div>
</div>

<h3>Column Direction</h3>
<div class="p-grid p-dir-col">
    <div class="p-col">
        <div class="box">1</div>
    </div>
    <div class="p-col">
        <div class="box">2</div>
    </div>
    <div class="p-col">
        <div class="box">3</div>
    </div>
</div>

<h3>Reverse Column Direction</h3>
<div class="p-grid p-dir-col-rev">
    <div class="p-col">
        <div class="box">1</div>
    </div>
    <div class="p-col">
        <div class="box">2</div>
    </div>
    <div class="p-col">
        <div class="box">3</div>
    </div>
</div>

<h3>12 Column Grid</h3>
<div class="p-grid">
    <div class="p-col-4">
        <div class="box">4</div>
    </div>
    <div class="p-col">
        <div class="box">1</div>
    </div>
    <div class="p-col">
        <div class="box">1</div>
    </div>
    <div class="p-col">
        <div class="box">1</div>
    </div>
    <div class="p-col">
        <div class="box">1</div>
    </div>
    <div class="p-col">
        <div class="box">1</div>
    </div>
    <div class="p-col">
        <div class="box">1</div>
    </div>
    <div class="p-col">
        <div class="box">1</div>
    </div>
    <div class="p-col">
        <div class="box">1</div>
    </div>
</div>

<div class="p-grid">
    <div class="p-col-2">
        <div class="box">2</div>
    </div>
    <div class="p-col-6">
        <div class="box">6</div>
    </div>
    <div class="p-col-4">
        <div class="box">4</div>
    </div>
</div>

<div class="p-grid">
    <div class="p-col-8">
        <div class="box">8</div>
    </div>
    <div class="p-col-2">
        <div class="box">2</div>
    </div>
    <div class="p-col-2">
        <div class="box">2</div>
    </div>
</div>

<h3>MultiLine</h3>
<div class="p-grid">
    <div class="p-col-6">
        <div class="box">6</div>
    </div>
    <div class="p-col-6">
        <div class="box">6</div>
    </div>
    <div class="p-col-6">
        <div class="box">6</div>
    </div>
    <div class="p-col-6">
        <div class="box">6</div>
    </div>
</div>

<h3>Fixed Width Column</h3>
<div class="p-grid">
    <div class="p-col-fixed" style="width:100px">
        <div class="box">100px</div>
    </div>
    <div class="p-col">
        <div class="box">auto</div>
    </div>
</div>

<h3>Responsive</h3>
<div class="p-grid">
    <div class="p-col-12 p-md-6 p-lg-3">
        <div class="box">p-col-12 p-md-6 p-lg-3</div>
    </div>
    <div class="p-col-12 p-md-6 p-lg-3">
        <div class="box">p-col-12 p-md-6 p-lg-3</div>
    </div>
    <div class="p-col-12 p-md-6 p-lg-3">
        <div class="box">p-col-12 p-md-6 p-lg-3</div>
    </div>
    <div class="p-col-12 p-md-6 p-lg-3">
        <div class="box">p-col-12 p-md-6 p-lg-3</div>
    </div>
</div>

<h3>Horizontal Alignment - Start</h3>
<div class="p-grid p-justify-start">
    <div class="p-col-2">
        <div class="box">2</div>
    </div>
    <div class="p-col-1">
        <div class="box">1</div>
    </div>
    <div class="p-col-4">
        <div class="box">4</div>
    </div>
</div>

<h3>Horizontal Alignment - End</h3>
<div class="p-grid p-justify-end">
    <div class="p-col-2">
        <div class="box">2</div>
    </div>
    <div class="p-col-1">
        <div class="box">1</div>
    </div>
    <div class="p-col-4">
        <div class="box">4</div>
    </div>
</div>

<h3>Horizontal Alignment - Center</h3>
<div class="p-grid p-justify-center">
    <div class="p-col-2">
        <div class="box">2</div>
    </div>
    <div class="p-col-1">
        <div class="box">1</div>
    </div>
    <div class="p-col-4">
        <div class="box">4</div>
    </div>
</div>

<h3>Horizontal Alignment - Between</h3>
<div class="p-grid p-justify-between">
    <div class="p-col-2">
        <div class="box">2</div>
    </div>
    <div class="p-col-1">
        <div class="box">1</div>
    </div>
    <div class="p-col-4">
        <div class="box">4</div>
    </div>
</div>

<h3>Horizontal Alignment - Around</h3>
<div class="p-grid p-justify-around">
    <div class="p-col-2">
        <div class="box">2</div>
    </div>
    <div class="p-col-1">
        <div class="box">1</div>
    </div>
    <div class="p-col-4">
        <div class="box">4</div>
    </div>
</div>

<h3>Horizontal Alignment - Even</h3>
<div class="p-grid p-justify-even">
    <div class="p-col-2">
        <div class="box">2</div>
    </div>
    <div class="p-col-1">
        <div class="box">1</div>
    </div>
    <div class="p-col-4">
        <div class="box">4</div>
    </div>
</div>

<h3>Vertical Alignment - Start</h3>
<div class="p-grid p-align-start vertical-container">
    <div class="p-col">
        <div class="box">4</div>
    </div>
    <div class="p-col">
        <div class="box">4</div>
    </div>
    <div class="p-col">
        <div class="box">4</div>
    </div>
</div>

<h3>Vertical Alignment - End</h3>
<div class="p-grid p-align-end vertical-container">
    <div class="p-col">
        <div class="box">4</div>
    </div>
    <div class="p-col">
        <div class="box">4</div>
    </div>
    <div class="p-col">
        <div class="box">4</div>
    </div>
</div>

<h3>Vertical Alignment - Center</h3>
<div class="p-grid p-align-center vertical-container">
    <div class="p-col">
        <div class="box">4</div>
    </div>
    <div class="p-col">
        <div class="box">4</div>
    </div>
    <div class="p-col">
        <div class="box">4</div>
    </div>
</div>

<h3>Vertical Alignment - Stretch</h3>
<div class="p-grid p-align-stretch vertical-container">
    <div class="p-col">
        <div class="box box box-stretched">4</div>
    </div>
    <div class="p-col">
        <div class="box box box-stretched">4</div>
    </div>
    <div class="p-col">
        <div class="box box box-stretched">4</div>
    </div>
</div>

<h3>Vertical Alignment - Per Column</h3>
<div class="p-grid vertical-container">
    <div class="p-col p-col-align-start">
        <div class="box">4</div>
    </div>
    <div class="p-col p-col-align-center">
        <div class="box">4</div>
    </div>
    <div class="p-col p-col-align-end">
        <div class="box">4</div>
    </div>
</div>

<h3>Offset</h3>
<div class="p-grid">
    <div class="p-col-6 p-offset-3">
        <div class="box">6</div>
    </div>
</div>

<div class="p-grid">
    <div class="p-col-4">
        <div class="box">4</div>
    </div>
    <div class="p-col-4 p-offset-4">
        <div class="box">4</div>
    </div>
</div>

<h3>Nested</h3>
<div class="p-grid nested-grid">
    <div class="p-col-8">
        <div class="p-grid">
            <div class="p-col-6">
                <div class="box">6</div>
            </div>
            <div class="p-col-6">
                <div class="box">6</div>
            </div>
            <div class="p-col-12">
                <div class="box">12</div>
            </div>
        </div>
    </div>
    <div class="p-col-4">
        <div class="box box-stretched">4</div>
    </div>
</div>

<h3>Panel Integration</h3>
<div class="p-grid">
    <div class="p-col">
        <p-panel header="Godfather">
            The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding.
            His beloved son Michael has just come home from the war, but does not intend to become part of his father's business.
            Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family,
            kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family.
        </p-panel>
    </div>
    <div class="p-col">
        <p-panel header="Godfather">
            The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding.
            His beloved son Michael has just come home from the war, but does not intend to become part of his father's business.
            Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family,
            kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family.
        </p-panel>
    </div>
    <div class="p-col">
        <p-panel header="Godfather">
            The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding.
            His beloved son Michael has just come home from the war, but does not intend to become part of his father's business.
            Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family,
            kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family.
        </p-panel>
    </div>
</div>

<h3>Sample Layout</h3>
<div class="p-grid sample-layout">
    <div class="p-col-12 p-md-2">
        Menu
    </div>
    <div class="p-col-12 p-md-10  p-col-nogutter">
    <div class="p-grid">
        <div class="p-col-12 p-col-nogutter">
            Top Bar
        </div>
            <div class="p-col-12">
                <div class="p-grid">
                    <div class="p-col-12 p-md-4">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet, orci nec
                        dictum convallis, ligula mauris vestibulum turpis, nec varius tortor quam at diam. Nullam a viverra nibh.
                        In tincidunt tempor lectus quis vulputate. Pellentesque nec dui aliquam, lobortis est in, lobortis ante</div>
                    <div class="p-col-12 p-md-4">Maecenas vel nisi aliquet, vulputate tortor id, laoreet massa. Maecenas mattis
                        tristique bibendum. Suspendisse vel mi dictum, vestibulum lacus quis, pulvinar quam. Proin vulputate, nibh
                        at finibus varius, leo eros lacinia elit, nec blandit odio tellus a justo. Donec nec ex auctor, tristique
                        nulla nec, rutrum sapien.</div>
                    <div class="p-col-12 p-md-4">Proin efficitur in leo eget ornare. Nam vestibulum neque sed velit sagittis
                        sodales. Sed scelerisque hendrerit magna a hendrerit. Cras tempor sem at justo pharetra convallis.
                        Curabitur vel sodales purus. Vestibulum interdum facilisis nulla imperdiet suscipit. Quisque lectus felis,
                        condimentum eget hendrerit sit amet.</div>
                    <div class="p-col-6 p-md-3"><></div>
                    <div class="p-col-6 p-md-3"><></div>
                    <div class="p-col-6 p-md-3"><></div>
                    <div class="p-col-6 p-md-3"><></div>

                    <div class="p-col-12 p-md-6">Phasellus faucibus purus volutpat mauris lacinia sodales. Ut sit amet sapien
                        facilisis, commodo dui non, fringilla tellus. Quisque tempus facilisis nisi sodales finibus. Pellentesque
                        neque orci, ullamcorper vitae ligula quis, dignissim euismod augue.</div>
                    <div class="p-col-12 p-md-6">Fusce ullamcorper congue massa, eget ullamcorper nunc lobortis egestas. Lorem
                        ipsum dolor sit amet, consectetur adipiscing elit. Quisque ultrices dui eget dolor feugiat dapibus. Aliquam
                        pretium leo et egestas luctus. Nunc facilisis gravida tellus.</div>
                </div>     
            </div>
        </div>
    </div>
    <div class="p-col-12">
        Footer
    </div>
</div>

<style type="text/css">
    .box,
    .sample-layout > div {
        background-color: #cce4f7;
        text-align: center;
        padding-top: 1em;
        padding-bottom: 1em;
        border-radius: 4px;
    }

    .box-stretched {
        height: 100%;
    }

    .sample-layout {
        margin: 0;
    }

    .sample-layout > div {
        border: 1px solid #ffffff;
    }

    .vertical-container {
        margin: 0;
        height: 200px;
        background: #efefef;
        border-radius: 4px;
    }

    .nested-grid .p-col-4 {
        padding-bottom: 1em;
    }
<style>