HTML5 default input content clears the "X" button removal method

Source: Internet
Author: User

inputThe box size is not very good to control ( padding ignore); The Firefox browser seems to be indifferent to any type of input box; The Ie10+ browser appears to have a clear button in any input box, but it is slightly rougher, and the designer can't accept it.

Seems to be not harmonious, how to do? Teach a new skill, using HTML and CSS, to simulate a search box that can be dynamically rendered by the clear button.

The following CSS:

. input {padding:5px; margin:0; border:1px solid #beceeb;}. clear {display:none; position:absolute; width:16px; height:16px; margin:6px 0 0-20px; Background:url (clear.png);} . input::-ms-clear {display:none;}. Input:valid +. Clear {display:inline;}

The following HTML:

Enter any content:Required>

And then there's a similar effect.

HTML5 default input content clears the "X" button removal method

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.