How to modify the mobile device button default Style

Source: Internet
Author: User

In the process of making Web pages for mobile devices, you may encounter the following strange phenomenon: When you set a style for a button, and when the browser opens the emulator to see the effect, everything is fine.

But when you're using a real-time test, your buttons turn out to look like this:

And even if you use the ultimate ban border-radius: 0 !important , it's useless.

This is because in mobile devices, browsers provide a set of styles that conform to the native system interface style for some basic controls (button,checkbox,scrollbarbutton-up). These styles are hidden, but the priority is the highest, so high that you can't go beyond even using the forbidden technique !important .

This is obviously unscientific.

Don't be afraid, we have two very reliable style declarations that tell the browser to completely discard the default style of the control and calculate our style sheet in a normal way.

The two declarations are:

    • -moz-appearance: none: Used to cancel the Gecko native system control style provided by the engine-based browser (such as Firefox);
    • -webkit-appearance: none: Used to cancel Webkit native system control styles provided by browsers based on (such as Safari) and Blink (e.g., chrome,opera) engines;

So, do you understand what it's like to have a strange phenomenon when you come across an article? Direct two statements come on, boy!

Finally, you might wonder what the appearance attribute value is, poke here and see what the MDN says.

PS: Poke here and find more possibilities.

How to modify the mobile device button default Style

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.