I have a normal form with mat-form-field inputs inside. Form contains a field for date and a field for hour. The fields are looking good in chrome:
However, in Firefox and Microsoft Edge the one field has a bigger height than the other:
I'm not really sure what might cause such thing, especially that my components don't implement any special styles to the inputs. I'm just using Flex Layout
<!-- Date and Time Start -->
<div fxFlex
fxLayout.lt-sm="column"
fxLayoutGap="2%"
fxLayoutAlign.gt-sm="space-around stretch"
fxLayout="row">
<!-- Date Start -->
<mat-form-field appearance="fill"
fxFlex
color="accent">
<input id="inputDateStart"
matInput
[formControl]="startDate"
(dateChange)="startDateChanged($event.value)"
[matDatepicker]="pickerStart"
[max]="startDatePickerMax"
placeholder="ab">
<mat-error>{{ getErrorMsgForDate() }}</mat-error>
<mat-datepicker-toggle matSuffix
[for]="pickerStart"></mat-datepicker-toggle>
<mat-datepicker #pickerStart></mat-datepicker>
<mat-hint>Ab Aufnahmedatum</mat-hint>
</mat-form-field>
<!-- Time Start -->
<app-w-mat-timepicker color="accent"
id="timePickerStart"
placeholder="von"
[timeFormat]="24"
[(userTime)]="startTimeToFilterFor"
(userTimeChange)="startTimeChanged($event)"></app-w-mat-timepicker>
</div>
And my clock component
<div fxFlex
fxLayout="row">
<mat-form-field fxFlex
appearance="fill"
color="accent">
<input matInput
[placeholder]="placeholder"
[value]="time">
<mat-hint>Uhrzeit</mat-hint>
<mat-icon matSuffix
(click)="showPicker($event)"
svgIcon="clock"></mat-icon>
</mat-form-field>
</div>
Stackblitz example
The problem was with the icon of the datepicker, it is too big!
To solve this, I had to add the icon manually to my project and then use it inside the mat-datepicker-toggle component.
Reference this answer https://stackoverflow.com/a/48924487/4956266
The answer of Motassem Jalal is correct. The icon of the datepicker is too big.
But you don't have to add your own icon. You can simply change the the font-size in the mat-datepicker-toggle component.
For example:
mat-datepicker-toggle {
font-size: 10px;
}
and in html:
<mat-form-field appearance="fill">
<mat-label>Label</mat-label>
<input matInput [matDatepicker]="dateToPicker" />
<mat-datepicker-toggle matSuffix [for]="dateToPicker"></mat-datepicker-toggle>
<mat-datepicker #dateToPicker></mat-datepicker>
</mat-form-field>
Related
I need to put a date in my apllication so I do this:
<!--data -->
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 col-xl-6 form-group">
<mat-form-field>
<mat-label>Data di nascita</mat-label>
<!-- #docregion toggle -->
<input matInput [matDatepicker]="picker" placeholder="gg/MM/yyyy">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
<!-- #enddocregion toggle -->
</mat-form-field>
</div>
The problem is I don't know how remove this focus in the image:
In my style.css I do this:
#import '~#angular/material/theming';
#import '~bootstrap-italia/dist/css/bootstrap-italia.min.css';
The problem could be some rules that I import. Anyone can help to remove the focus yellow in the components that I have seen in my image?
It's because of the default input style use this
input:focus { outline: none; }
::ng-deep *,*:focus,*:hover{
outline:none !important;
}
Add this CSS to your Page CSS file
I am using angular material, I need to change the primary color for text box alone.
Is there any way to change only for text box
<mat-form-field class="example-full-width">
<mat-label>Favorite food</mat-label>
<input matInput placeholder="Ex. Pizza" value="Sushi">
</mat-form-field>
I want to change the underline color.
Try to add a class to the input field.
<mat-form-field class="example-full-width">
<mat-label>Favorite food</mat-label>
<input class="fav-food-input" matInput placeholder="Ex. Pizza" value="Sushi">
</mat-form-field>
In your css file
.fav-food-input{
color: red !important; //Whichever color you need
}
I'm using Angular with Material Design components. How can I add a border around a textarea input field using CSS?
Example textarea from https://material.angular.io/components/input/examples:
<form class="example-form">
<mat-form-field class="example-full-width">
<textarea matInput placeholder="Leave a comment"></textarea>
</mat-form-field>
</form>
What the default textarea looks like
if you add appearance="outline" to your mat-form-field it will add a border around your field
source: https://material.angular.io/components/form-field/overview
<mat-form-field class="example-full-width" appearance="outline">
<textarea matInput placeholder="Leave a comment"></textarea>
</mat-form-field>
I have a problem with the automatic layout of jquery mobile:
i have a form with fieldsets:
<div data-role="collapsible" data-collapsed="false" data-theme="a">
<h3>Test</h3>
<div data-role="fieldcontain">
<label for="TextInput"> Textinput </label>
<input type="text" name="TextInput" id="TextInput">
</div>
<div data-role="fieldcontain">
<label for="ButtonInput"> Button </label>
<a href="javascript:alert('works')" data-icon="arrow-r" data-role="button" data-iconpos="right">
<label id="ButtonInput" name="ButtonInput"> Testvalue </label>
</a>
</div>
</div>
On Displays with a lower resolution everything work fine. The labels are shown in the first row, the inputs are shown in the second row:
Textinput
[Inputbox]
Button
[Button]
On Displays with a higher resolution, the input field and the label are shown in 1 row
Textinput [InputBox]
but the Button is still shown in 2 Rows:
Button
[Button]
Anyone knows the problem?
This is not an error, jQM was build to act like that.
If you want to fix it just use this simple css:
#TextInput {
width: 100% !important;
}
working example: http://jsfiddle.net/Gajotres/xrVU2/
Please check my code at http://jsfiddle.net/TccN5/.
It has a gap between the input text box and the button on the right. For the very same markup on Bootstrap site the input box and the button has a nice tight fit with no gap.
Why do I have the gap?
You have extra whitespace characters between button and input elements. Place button tag immediately after input element:
<input type="text" /><button class="btn" type="button">Any</button>
DEMO1
Or alternatively, apply this css styles:
.input-append{
font-size:0;
}
DEMO2
Im not sure why that is, but this is how i fixed it. maybe you got some of your own css conflicting with the text field.
here's the jsfiddle with the fix http://jsfiddle.net/TccN5/2/
I just added
style="margin-right:-4px"
to your
<input type="text">
Use input-prepend and input-append
<div class="btn-group input-prepend input-append">
<input type="button" class="btn" value="Prev">
<input type="text" value="">
<input type="button" class="btn" value="Next">
<div>