Example of how CSS clears form form styles

Source: Internet
Author: User
Common clear styles for forms in development projects:

1. Change placeholder default font color

::-webkit-input-placeholder{color: #333;}:-moz-placeholder{color: #333;}:-moz-placeholder{color: #333;}:- Ms-input-placeholder{color: #333;}

2. Cancel the up and down arrows of input number

Input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none!important;} Input[type= "number"]{-moz-appearance:textfield;}

3. Select drop-down selection box option text right align

Direction:rtl;

4. Select Right ARROW Hide

-webkit-appearance:none;

5, clear the lower right corner of the textarea can be dragged function

Resize:none;

6, TextArea text box height adaptive

<p class= "Ta_box" >    <textarea class= "Ta" ></textarea></p>
. ta_box{    width:400px;    Height:auto;    Overflow:hidden;    border:1px solid #999;    Box-sizing:border-box;}. ta{    min-height:30px;    Outline:none;    Resize:none;    width:500px;    Box-sizing:border-box;    Vertical-align:top;    Border:none;}
$.fn.autoheight = function () {    function autoheight (elem) {        elem.style.height = ' auto ';        elem.scrolltop = 0;  Anti-jitter        elem.style.height = elem.scrollheight + ' px ';    }    This.each (function () {        autoheight (this);        $ (this). On (' KeyUp ', function () {            autoheight (this);        });    } $ (' textarea '). Autoheight ();

The code here needs to refer to JQ, which is the outermost of the structure. Ta_box is designed to eliminate sliders and optimize the user experience.

The extended function of JQ is used here.

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.