ChatGPT解决这个技术问题 Extra ChatGPT

Styling input buttons for iPad and iPhone

I'm using CSS to style the input buttons on my website, but on IOS devices the styling is replaced by Mac's default buttons. Is there a way to style buttons for iOS, or a way to maybe make a hyperlink that behaves like a submit button?


J
Jonas G. Drange

You may be looking for

-webkit-appearance: none;

Safari CSS notes on -webkit-appearance

Mozilla Developer Network's -moz-appearance


There is still a difference in button depress/:active styling, right? It ignores your styles and applies a semitransparent grey overlay?
If you're using SCSS, use @include experimental(appearance, none);
The link above is now dead, unfortunately (thinkvitamin.com/design/…).
One issue with this is that for <select> boxes, it doesn't display the arrow when on a Desktop browser. So this is best paired with a media query I think.
What... Was it really this simple? I used a lot of CSS lines to style it and this line was enough to do the trick?!
s
subindas pm

Please add this css code

input {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}

D
Digital Robot Gorilla

I recently came across this problem myself.

<!--Instead of using input-->
<input type="submit"/>
<!--Use button-->
<button type="submit">
<!--You can then attach your custom CSS to the button-->

Hope that helps.


That still doesn't allow me to change the height of a button. Funny thing though, as soon as I give the button a custom width the custom height is also taken into account.
This was the fix for UIkit v3.
v
vinod

Use the below css

input[type="submit"] { font-size: 20px; background: pink; border: none; padding: 10px 20px; } .flat-btn { -webkit-appearance: none; /*For Chrome*/ -moz-appearance: none;/*For Mozilla*/ appearance: none; border-radius: 0; } h2 { margin: 25px 0 10px; font-size: 20px; }

iOS Styled Button!

No More Style! Button!


d
djnose

I had the same issue today using primefaces (primeng) and angular 7. Add the following to your style.css

p-button {
   -webkit-appearance: none !important;
}

i am also using a bit of bootstrap which has a reboot.css, that overrides it with (thats why i had to add !important)

button {
  -webkit-appearance: button;

}


K
Karthiha Karthi

-webkit-appearance: none;

Note : use bootstrap to style a button.Its common for responsive.