Stop Safari Mobile from giving input buttons rounded corners - ios

I guess the subject says it all. I have a web application when viewed on an Iphone, Ipod or Ipad, input submit buttons have rounded corners. Is there a way to stop this?

If you add...
input, textarea {
-webkit-appearance: none;
border-radius: 0;
}
Then your buttons will inherit any CSS styles that you have applied for other browsers.

Didn't work for me, the -webkit-appearance:none.
This does:
input[type=submit] {
-webkit-border-radius:0px;
}
I had the same issue with rounded corners on a button with background image, just on the iPhone.

You can try to use following CSS:
-webkit-appearance:none;
More info: http://trentwalton.com/2010/07/14/css-webkit-appearance/

I've found that on iPad 2 you have to use the following:
-webkit-appearance:none;
border-radius: 0;
in your button class.

I had a site with an input submit type="image". This vairation of the above fixed the rounded corners:
input[type=image] {
-webkit-border-radius:0px;
}

I've found that setting background: linear-gradient(color1, color2) gets rid of the overly rounded corners on Apple devices and works on all other browsers/platforms I have tried.

I solved by adding code for both the "button" and "submit" types:
input[type="submit"] {
text-align: center;
-webkit-appearance:none;
-webkit-border-radius:0px;
border-radius:0;
height:30px;
}
input[type="button"] {
text-align: center;
-webkit-appearance:none;
-webkit-border-radius:0px;
border-radius:0;
height:30px;
}

Related

angular-material change checkbox color

I'm using checkbox of angular-material2. Currently the default color of checkbox is coming as purple color.
Looks like they have changed default color of checkbox from "primary" to accent.
Is there a way to get "primary"(green) color instead of purple without overriding css.
I tried giving color="primary" to but that didn't worked.
Code : <md-checkbox></md-checkbox>
Import statement:
import {MdCheckbox} from '#angular2-material/checkbox';
Plunker http://plnkr.co/edit/sFC0kfdzj7fxtUC3GXdr?p=preview
Based on feedback from comments, updated my answer by removing '::ng-deep', but please read comment by #colin-fox, and understand how this will behave in global styling and at component level, many thanks!
For Angular Material 7, works for outline color and inside filled in color
.mat-checkbox-checked.mat-accent .mat-checkbox-ripple .mat-ripple-element {
opacity: 0.03 !important;
background-color: #005691!important;
}
.mat-checkbox-checked.mat-accent .mat-checkbox-background,.mat-checkbox-indeterminate.mat-accent .mat-checkbox-background {
background-color: #005691;
}
You don't have to add css if you'r using theme, just add attribute color to <mat-checkbox>
<mat-checkbox color="primary">Primary</mat-checkbox>
The color of a <mat-checkbox> can be changed by using the color property. By default, checkboxes use the theme's accent color. This can be changed to 'primary' or 'warn'
Checkbox | Angular Material
One of the standard ways to do this is to utilize the /deep/ selector
mat-checkbox {
color: rgb(0,178,0);
/deep/ .mat-checkbox-background {
background-color: rgb(0,178,0);
}
/deep/ &.mat-checkbox-focused{
.mat-ink-ripple{
background-color: rgba(0, 178, 0, .26);
}
}
}
That will allow you to override styles in components where Shadow Dom is enabled.
This solution works well for me
.mat-checkbox-ripple .mat-ripple-element,
.mat-checkbox-checked.mat-accent .mat-checkbox-background {
background-color: $your-color !important;
}
Default color depends upon the theme which you #import.
But angular material also provide way to customize the theme or for customizing the components like changing the color of checkbox.
Steps of doing this as follow :-
1.) Import the _theming.scss file
#import "../node_modules/#angular/material/theming";
2.) Specify the accent color i.e. color of check box you want to apply like below :-
// customising of the mat-checkbox accordiing Theme. i am using pink indigo theme
bydefault so here I am changing the checkbox color from pink to grey.
$candy-app-primary: mat-palette($mat-indigo);
// here I am specify the grey instead of Pink.
$candy-app-accent: mat-palette($mat-grey, 600, 500, 900);
$candy-app-warn: mat-palette($mat-red);
// Create the theme object (a Sass map containing all of the palettes).
$candy-app-theme: mat-light-theme($candy-app-primary, $candy-app-accent, $candy-app-warn);
// here I am only calling checkbox mixin because i only want to change the checkbox color
#include mat-checkbox-theme($candy-app-theme);
Hope it will help.
Angular 7+
This will work for checkbox as well as the initial ripple color. If you just change the background for the checkbox, the initial ripple color won't update. This resolves the issue.
SCSS:
::ng-deep .mat-checkbox-checked.mat-accent {
.mat-checkbox-ripple .mat-ripple-element {
background-color: $your-color !important;
}
.mat-checkbox-background, .mat-checkbox-indeterminate.mat-accent .mat-checkbox-background {
background-color: $your-color;
}
}
::ng-deep .mat-checkbox.mat-accent {
.mat-checkbox-ripple .mat-ripple-element {
background-color: $your-color !important;
}
}
A combination of answers worked for me in angular 9
.mat-checkbox-checked.mat-accent .mat-checkbox-ripple .mat-ripple-element {
opacity: 0.03 !important;
background-color: #005691 !important;
}
.mat-checkbox-checked.mat-accent .mat-checkbox-background,
.mat-checkbox-indeterminate.mat-accent .mat-checkbox-background {
background-color: #005691 !important;
}
.mat-checkbox-ripple .mat-ripple-element,
.mat-checkbox-checked.mat-accent .mat-checkbox-background {
background-color: #005691 !important;
}
With beta.2 of Angular Material, the color attribute should work.
There were some issues with it before beta.2
See the commit that fixed that issue.
There are two methods(that i know ) to change the background color of mat-checkbox (angular 9)-
method 1 - by using color property of the mat-checkbox .
<mat-checkbox
id="{{ subtask.name }}"
[color]="accent"
>
Check
</mat-checkbox>
Limitation - You can only use color according to the angular material theme by this method .
method 2 - If you want to give custom colors to the mat-checkbox first track down the classes till the target class you want to change color of. tracking of nested classes
after that write like this in your style.css(global) file-
1st checkbox
.l0
.mat-checkbox-checked
.mat-checkbox-layout
.mat-checkbox-inner-container
.mat-checkbox-background {
background-color: #ffbf00 !important;
}
2nd checkbox
.l1
.mat-checkbox-checked
.mat-checkbox-layout
.mat-checkbox-inner-container
.mat-checkbox-background {
background-color: #4caf50 !important;
}
Result - different color for different mat-checkbox
This should take care of the default checkbox color
md-checkbox .md-icon {
background: green;
}
md-checkbox.md-default-theme.md-checked .md-icon {
background: green;
}
read more here at Angular Material Documentation
The following will keep frame grey when unchecked but change to custom color when checked:
relevant-scss-file.scss
mat-checkbox {
&.mat-checkbox-disabled.mat-checkbox-checked .mat-checkbox-background {
background: rgb(0,178,0);
}
}
Since deep is deprecated. In my view the right way to do it is using encapsulation: ViewEncapsulation.None.
ex:
#Component({
selector: '...',
templateUrl: '...',
styleUrls: ['...'],
encapsulation: ViewEncapsulation.None,
})
Then you just need to change the class
.mat-checkbox-background {
background-color: green;
}
You just need to be careful to deal with global css stuff. In SASS nested classes should handle it properly.
You can have more details here: https://stackoverflow.com/a/54672579/783364
For me what has worked is the following:
<mat-checkbox class="tn-checkbox">Check me!</mat-checkbox>
In the css (or in my case sass):
.#{$wf__ns}checkbox {
.mat-checkbox-ripple {
.mat-ripple-element {
background: $cool-blue !important;
}
}
&.mat-checkbox-checked {
.mat-checkbox-background {
background: $cool-blue;
}
.mat-checkbox-ripple {
.mat-ripple-element {
background: $cool-blue !important;
}
}
}
}
Explanation:
The checked background color is changed to mat-checkbox-background within mat-checkbox-checked. IF you want to modify the background color when it is not checked just copy that part and copy it outside of mat-checkbox-checked.
As for the ripple classes, it turns out that the material has an animation when you press the button. That class controls the color of the animation, if you don't change it it will remain the same (pink).
If you do not change it by pressing the checkbox you will see a strange pink effect.
The other answers do not work for me although I rely on the first to develop it.
It may be from my version of angular that I leave below:
Angular CLI: 8.3.25
Node: 13.3.0
Angular: 8.2.14
You can change the color of the border this way.(angular)
::ng-deep .mat-checkbox {
.mat-checkbox-ripple .mat-ripple-element {
background-color: #07abe9 !important;
}
.mat-checkbox-frame {
border-color: #07abe9 !important;
}
}
This worked for me with Angular 10:
In your styles.scss:
//Change background color
.mat-checkbox-checked.mat-accent .mat-checkbox-background,
.mat-checkbox-indeterminate.mat-accent .mat-checkbox-background {
background-color: #1f45cc;
}
//Change the border color for both checked and unchecked cases
.mat-checkbox-frame {
border-color: #1f45cc;
}
.mat-checkbox-ripple .mat-ripple-element,.mat-checkbox-checked.mat-accent .mat-checkbox-background {
background-color: $your-color!important;
}
.mat-checkbox-checked.mat-primary .mat-checkbox-background, .mat-checkbox-indeterminate.mat-primary .mat-checkbox-background{
background-color: $your-color!important;
}
This is what works. On our JHIPSTER project, we have a global.scss. Here is what you need to do if you do have a global.
Wrap your component html with a class. Forexample:
<div class="supplier-details-container">
<!-- rest of your html here -->
</div>
In the global.scss or global.css write your css/scss like so (Im using red to test):
.supplier-details-container .mat-checkbox-ripple .mat-ripple-element,.mat-checkbox-checked.mat-accent .mat-checkbox-background {
background-color: red !important;
}
Basically using css hierarchy wrapping the native angular material css with your component class that you use to wrap your component html.
Let me know if it works or not. We can debug.
Update for Angular Material 15:
.mat-mdc-checkbox.mat-mdc-checkbox-checked .mdc-checkbox__background, .mdc-checkbox__ripple {
background-color: green !important;
border-color: green !important;
}
this solution works well for me
/deep/.mat-checkbox-checked.mat-accent .mat-checkbox-background, .mat-checkbox-indeterminate.mat-accent .mat-checkbox-background {
background-color: #3490d3;
}

jquery mobile how remove the grey round circle on icon

I build my first phonegap Jquery Appl
Im changing my icon using this class
.ui-icon-myapp-email {
background-image: url("app-icon-email.png");
}
This custom icon is for a list view , and i try to remove the round grey background load
Also my picture is a bit big for the shape
I was playing with the .ui-icon but doesnt work
Cant find the class
I just wanna my custom arrow picture full size on a white background list no round no circle box shape
Maybe there is an attribute or via css to make that
thanks
If you are using jQuery v 1.4.0 + then you just need to add the class .ui-nodisc-icon to your link element to remove that annoying circle. You will not need to edit any css or write any overrides.
Late to the party here, but a simple answer is to add
background-color: transparent;
box-shadow: none;
to your custom class name, so:
.ui-icon-myapp-email {
background-color: transparent;
box-shadow: none;
}
is all you need.
With JQuery Mobile 1.3, now all you have to do is add the class "ui-nodisc-icon", no need to mess around with the CSS.
from JQuery Website:
"If you don’t need the dark circle behind the icons, simply add the ui-nodisc-icon to the element or its container to remove the icon background."
This should work.
.ui-icon-myapp-email {
background:transparent; /* or none */
background-image: url("app-icon-email.png");
/* The following border radius rules will override the circle around your icon */
-moz-border-radius: 0px;
-webkit-border-radius:0px;
border-radius:0px;
}
/* To fix the size issue override the .ui-icon height */
.ui-icon{
width:14px;
height:20px;
}
Overrides the icon disc color to white.
.ui-icon,
.ui-icon-searchfield:after {
background: #fff /*{global-icon-color}*/;
background: rgba(255,255,255,1) /*{global-icon-disc}*/;
background-image: url(images/icons-18-white.png) /*{global-icon-set}*/;
background-repeat: no-repeat;
-moz-border-radius: 9px;
-webkit-border-radius: 9px;
border-radius: 9px;
}
Icon size is specified in ui-icon class which defaults to 18px.
.ui-icon {
width: 19px;
height: 19px;
}
For those of you looking to have just an icon for the button - I found this article to be very useful! I followed the "Reset the button theme" and "Icon-only buttons" sections to get the effect that I needed.
http://appcropolis.com/blog/advanced-customization-jquery-mobile-buttons/
I solved this issue, using:
background-color:transparent;
if you want to add color in background you can use:
background: url(yourimage.png) repeat;

JQuery Mobile remove disc background

is there a way to remove the background disc (circle) from around and icon? the only reference for a disc I've found is below
background: rgba(0,0,0,.4) /*{global-icon-disc}*/;
If your using jquery mobile 1.4 use class="ui-nodisc-icon"
Try something like this to override the JQM css.
.ui-icon, .ui-icon-searchfield::after {
background: transparent;
background-image: url(http://code.jquery.com/mobile/1.1.0/images/icons-18-white.png);
}​​​​​
In version 1.3.0, add class ui-icon-nodisc
I was having the same problem and came with this solution :
.ui-btn-icon-left:after, .ui-btn-icon-right:after, .ui-btn-icon-top:after, .ui-btn-icon- bottom:after, .ui-btn-icon-notext:after {
background-color: transparent !important;
}
This is what worked for me:
.az-nodisc {
background-color: transparent !important;
border: none;
box-shadow: none;
}
Then apply the style as:
test

iOS html5 css3 button click style

I write my application on HTML5/CSS3/JavaScript. For my button I create style (all work fine in browser), but when I start my application on iPad my active effect override standart iOS click effect.
How I can override this standart effect?
My style :
<style type="text/css">
.button {
display: inline-block;
width: 150px;
height: 50px;
background: #f78d1d;
background: -webkit-gradient(linear, left top, left bottom, from(#faa51a), to(#f47a20));
background: -moz-linear-gradient(top, #faa51a, #f47a20);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#faa51a', endColorstr='#f47a20');
}
.button:ACTIVE {
background: #f47c20;
background: -webkit-gradient(linear, left top, left bottom, from(#f88e11), to(#f06015) );
background: -moz-linear-gradient(top, #f88e11, #f06015);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f88e11', endColorstr='#f06015' );
}
My Button:
The answer to your problem I believe is very simple.
Add this following CSS code to your button or body tag (to affect the entire document).
body { -webkit-appearance: none; }
This will remove default styles for buttons that iOS places onto certain UI elements.
Hope that helps.
I had the same problem use the button tag and it seems to override.
<button class="button">Link</button>

Border Radius & Glowing Links

I Google searched the code for border radius & glowing buttons. When I got the code I replaced input with a. Here is the code:
a {
border:2px solid #dadada;
border-radius:7px;
font-size:20px;
padding:5px;
}
a:focus {
outline:none;
border-color:#9ecaed;
box-shadow:0 0 10px #9ecaed;
}
How do I make a link round and make it glow when hover?
Have you tried the pseudo class :hover instead of :focus?
a:hover{
/* glow code */
}
The only cross-platform solution I've been able to use successfully so far is: jQuery Glow.

Resources