Guide on relocating the label to the left side of the input fields

Can anyone assist me with aligning labels to the left of input fields in PrimeNG? I am unsure of how to do this. Here is a visual representation of what I am trying to achieve:

https://i.sstatic.net/qifpm.png

Below is the code that I currently have:

View Plunker

        <div class="ui-g-12 ui-md-6 ui-lg-4">
            <label>Set Date</label>
            <input id="input" type="text" size="30" pInputText [(ngModel)]="text"> 
        </div>

Answer №1

To organize your layout effectively, consider utilizing a smaller column named ui-grid-col4 for labels and a larger one called ui-grid-col8 for input fields:

     <div class="ui-g ui-fluid">

        <div class="ui-grid-col-4">
          <span>Phone Ext</span>
        </div>
        <div class="ui-grid-col-8">
          <p-inputMask mask="(999) 999-9999? x99999" [(ngModel)]="val5" placeholder="(999) 999-9999? x99999"></p-inputMask>
        </div>

        <br/><br/><br/>

        <div class="ui-grid-col-4">
          <span>Serial Number</span>
        </div>
        <div class="ui-grid-col-8">
          <p-inputMask mask="a*-999-a999" [(ngModel)]="val6" placeholder="a*-999-a999"></p-inputMask>
        </div>

    </div>

For a demonstration of this setup in action, check out the Plunker link provided.

To delve deeper into the grid functionality, consult the documentation available at the following link.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The device-width value in the viewport width setting is causing issues

My angular app desperately needs a mobile responsive design as it currently looks dreadful on mobile devices. I've tried adding <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, user-scalable=yes">, but ...

Creating a velocity gauge style graph in Angular 4: A step-by-step guide

Hello, I'm currently working on building a speedtest-inspired application. While everything else is going smoothly, I'm struggling to incorporate a speedometer-like chart in Angular 2/4. Despite searching extensively, I've only come across J ...

When is the scrollHeight determined?

I'm currently working on implementing a CSS transition within an accordion element that I am creating with Angular 7. To ensure proper display of the content inside, I have opted to use overflow-y: visible; as I will not be using this element personal ...

Applying a class to specific instances of selected text in Javascript, rather than just the first occurrence

I am trying to enhance a text using JavaScript by adding a class and then sending that string to PHP. However, I have encountered an issue where the code adds the class to the first occurrence of my selection instead of the actual selected text. My goal is ...

Avoiding double entries in the shopping list using DOM selectors in JavaScript

I have been struggling with preventing duplicate items from being added to a shopping list that I created. Even though I thought the code below would solve the issue, it hasn't been effective so far. My expectation was for the JavaScript code to acces ...

Loading Angular2 components dynamically from a module is a powerful feature that allows for greater

Within my Angular application, I have the following setup: export class MyComponent { subcompPath = "path-to-subcomp#SubcompClassName"; @ViewChild("placeholder", { read: ViewComponentRef }) placeholderRef: ViewComponentRef; /* Constructor where C ...

Toggle the visibility of div elements by clicking on another div

Hey everyone, I have this cool concept where clicking on different flags will reveal a corresponding list. However, my jQuery code doesn't seem to be functioning properly. $('.canadaflag').click( function() { $(".canadalocations").toggl ...

Difficulty in accurately identifying the current page on the appbar

I'm attempting to make the active page in my navbar stand out by giving it a white background color and skyblue text. However, for some reason, I can't get the text color to display as skyblue in the appbar. You can see how it currently looks in ...

Tips for aligning divs side by side with smaller divs stacked below them

I have a collection of dynamically generated divs that act as panels for selecting different options. These divs can be categorized into two types: regular and short. The height of the regular divs is determined using JavaScript to match the height of the ...

Integrate the hls.js library into your Angular project

I am encountering an error while trying to integrate the Videogular2 module into my Angular application, specifically with hls.js. Despite following the instructions in the Getting started guide, I keep seeing the following error in the developer console : ...

Maintain the chosen month in every dropdown toggle div in angular 4

While displaying data using toggle options, I am facing an issue where if I click on a different month, all other greyed out headers are displaying the previously selected values. I am trying to figure out a way to keep the value under Selected month as i ...

IE browser problem with pointer-events

Encountering a problem with the CSS property pointer-events:none;. It seems to be functioning correctly in modern browsers like Chrome and Mozilla, but is causing issues in Internet Explorer. Any suggestions for resolving this issue? Thank you ...

CSS regression testing through version control systems and continuous integration

Is there a tool that integrates with CI systems and VCS like Git to automatically assign regression test results to individual commits? Ideally, this tool would provide a concise summary on a main page showing passed/failed numbers for each commit, with th ...

Design custom CSS for the buttons inside one specific jQuery dialog among many on the same page

I am trying to specifically style the buttons within one jQuery dialog out of multiple dialogs on my page. Typically, I would target all dialog buttons using: .ui-dialog .ui-dialog-buttonpane and .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset H ...

Differences in background-size among various browsers

Having some trouble with scaling backgrounds on different browsers. Initially designed website on Google Chrome, but background doesn't scale properly when viewed on iPhone or older versions of IE. Started with: background-size: 100% 150%; Then c ...

The Bootstrap 4 navbar remains consistently visible on mobile devices

I am experiencing an issue with my bootstrap navbar on mobile devices. It remains visible even when the navbar-toggler is collapsed. Below is the code snippet: <nav class="navbar navbar-expand-lg navbar-light bg-light"> <div class="container"&g ...

The moving div suddenly halts before continuing its journey

Two overlapping divs create an interesting sliding effect. A gray div slides in from the top over a black div. Hovering your mouse over the black div causes the gray one to slide out of view. If you hover over the gray div, it also slides out but pauses ...

Issue with jQuery animation: Background color does not change upon scrolling

Here is my fiddle link: https://jsfiddle.net/jzhang172/owkqmtcc/5/ I am attempting to change the background color of the "content" div when scrolling anywhere within it. The goal is for the background color to change when scrolling and revert back to its ...

Images are not visible when scrolling horizontally

Hello everyone, this is my first time reaching out with a question here! I've been working on setting up a horizontal scroll feature and I'm almost there, but I'm encountering an issue where the scroll bar is appearing at the bottom of the ...

Transitioning Opacity in CSS

I found inspiration for my project from the following source: https://codepen.io/plavookac/pen/qomrMw One challenge I'm facing is changing the opacity of the movement, which is not covered by the standard transition markers. .mainInner{ display ...