question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Grid CSS / PrimeFlex: label align-issue with horizontal forms

See original GitHub issue

1) Environment

  • PrimeFaces version: 7.1 (SNAPSHOT)
  • Affected browsers: all browsers

2) Behavior

Grid CSS and PrimeFlex align labels on the upper left corner. This is not ideal. They should be baselined. grafik (Issue is not specific for babylon-theme.)

PrimeFlex offers CSS-class p-align-baseline to get this done right. But this has (at least) issues with SelectOneMenu: grafik

<h3>Responsive (PrimeFlex, p-align-baseline)</h3>
<p:panelGrid columns="4" layout="flex" columnClasses="p-col-12 p-md-3 p-xl-2, p-col-12 p-md-9 p-xl-4, p-col-12 p-md-3 p-xl-2, p-col-12 p-md-9 p-xl-4" contentStyleClass="p-align-baseline ui-fluid">
	<p:outputLabel for="text1" value="Text 1" />
	<p:inputText id="text1" />

	<p:outputLabel for="text2" value="Text 2" />
	<p:inputText id="text2" />

	<p:outputLabel for="date" value="Date" />
	<p:datePicker id="date" showIcon="true" style="width:auto" />

	<p:outputLabel for="checkbox" value="Checkbox" />
	<p:selectBooleanCheckbox id="checkbox" itemLabel="Checkbox" />

	<p:outputLabel for="text3" value="Text " />
	<p:inputText id="text3" />

	<p:outputLabel for="selectOne" value="SelectOne (misaligned)" />
	<p:selectOneMenu id="selectOne">
		<f:selectItem itemLabel="Select One" itemValue="" />
		<f:selectItem itemLabel="Xbox One" itemValue="Xbox One" />
		<f:selectItem itemLabel="PS4" itemValue="PS4" />
		<f:selectItem itemLabel="Wii U" itemValue="Wii U" />
	</p:selectOneMenu>
</p:panelGrid>

When we look to Bootstrap they solve this issue by offering the CSS-Class .col-form-label which add´s padding-top.

I´m currently not totaly sure what´s the best solution.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
mellowarecommented, Jan 23, 2020

@christophs78 I say we write a note in the documentation and then close this ticket.

1reaction
christophs78commented, Oct 14, 2019

@mertsincan came up with the following idea:

<style type="text/css">
   .customPanelGrid .ui-panelgrid-content {
            align-items: center;
    }
</style>

<p:panelGrid columns="4" layout="flex" columnClasses="p-col-12 p-md-3 p-xl-2, p-col-12 p-md-9 p-xl-4, p-col-12 p-md-3 p-xl-2, p-col-12 p-md-9 p-xl-4" styleClass="customPanelGrid">

This is not pixel-perfect but quite good: grafik

Read more comments on GitHub >

github_iconTop Results From Across the Web

label align-issue with horizontal forms - Prime Community Forum
When we look at https://www.primefaces.org/babylon/sample.xhtml labels are aligned at the top-left corner of the input. This is not ideal.
Read more >
Center the whole form vertically and horizontally using ...
I'm using PrimeFlex@2.0.0 and PrimeNG@12.0.0. Snippet. <div class="p-grid-nogutter"> <div ...
Read more >
Jsf Align Checkboxes In Panelgrid - ADocLib
Grid CSS / PrimeFlex: label align I have a panelGrid which contains description ... Grid CSS / PrimeFlex: label alignissue with horizontal forms...
Read more >
How to Center Anything in CSS Using Flexbox and Grid
Table of Contents ->. How to Use Flexbox to. center anything horizontally; center anything vertically; center both horizontally & Vertically.
Read more >
Bootstrap Horizontal alignment - examples & tutorial
Bootstrap 5 horizontal alignment utilities position elements on the x-axis. ... By using flexbox you can center the entire the column of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found