HTML5 input type= "color" border pseudo-class effect

Source: Internet
Author: User

HTML5 provides a new type for input: color

<input type= "Color" value= "#999" id= "Color" >

Clicking will pop up the color to modify the popup, but cannot modify the color transparency

After clicking on the switch color, the effect is as follows

The style is ugly, it's actually a two-tier Div, and Chrome provides two pseudo-classes to control them.

1 #color {Border: 0;} 2 ::-webkit-color-swatch-wrapper {Background-color:#ffffff;} 3 ::-webkit-color-swatch {position: relative;} 4 /* Description */5::-webkit-color-swatch-wrapper This is the outer container. 6::- Webkit-color-swatch This is the internal color button, changing the color will change

The effect is as follows, the outer layer is invisible

The problem comes again, after changing the color, there will be a box

Set Outline:none; it's okay.

HTML5 input type= "color" border pseudo-class effect

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.