-1

I am trying to align my text in the span tag to center of the input field. But when i used the "text-align": center in my css, it is not working.

When i changed the span tag to paragraph tag my input field become big.

the code:

<div class="nxui-form-group">
    <label for="external-realisation">
      <img src="assets/images/purchase_order.svg" class="nxui-icon-small nxui-icon-align-bottom">
      {{ 'i18n.all-damage-reports.label.external-realisation' | translate }}
    </label>
    <div *ngIf="!isExternal">
      {{ 'i18n.all-damage-reports.label.without-order' | translate }}
    </div>
    <div *ngIf="isExternal" class="nxui-label-plus-field">
      <span class="nxui-non-breakable-label">{{ 'i18n.all-damage-reports.label.with-order' | translate }}&nbsp;</span>
      <input [nxuiPlaceholder]="'i18n.all-damage-reports.label.external-realisation' | translate"
             [title]="'i18n.all-damage-reports.label.external-realisation' | translate"
             class="nxui-form-control"
             formControlName="company"
             id="external-realisation"
             pInputText
             >
    </div>
  </div>

It looks like this when i added the paragraph tag: enter image description here

With span tag: enter image description here

Answer to my question:

.nxui-label-plus-field {
  display: flex;
  align-items: center;
}

.nxui-non-breakable-label {
  white-space:nowrap ;
}

highly appreciated for the inputs.

Thanks

2 Answers2

2

HTML:

<div *ngIf="isExternal" class="nxui-label-plus-field">
  <span class="nxui-non-breakable-label">{{ 'i18n.all-damage-reports.label.with-order' | translate }}&nbsp;</span>
  <input [nxuiPlaceholder]="'i18n.all-damage-reports.label.external-realisation' | translate"
         [title]="'i18n.all-damage-reports.label.external-realisation' | translate"
         class="nxui-form-control"
         formControlName="company"
         id="external-realisation"
         pInputText
         >
</div>

CSS:

<style>
   .nxui-label-plus-field { 
      display: flex;
      align-items: center;
    }
</style>
Sheeban Singaram
  • 357
  • 1
  • 12
0

add this style="text-align:center" to you input element to be like that

 <input [nxuiPlaceholder]="'i18n.all-damage-reports.label.external-realisation' | translate"
             [title]="'i18n.all-damage-reports.label.external-realisation' | translate"
             class="nxui-form-control"
             formControlName="company"
             id="external-realisation"
             pInputText
             style="text-align:center"
             >