hide placeholder with css

后端 未结 6 1077
感动是毒
感动是毒 2020-12-13 18:14

I\'m working with a responsive theme. And I\'m facing the input form problem here. In the desktop view, the input will not have placeholder but have label.

However,

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 18:34

    CSS only provides the styling, it can not remove the actual placeholder.

    What you can do it, set the placeholder text color as your background color of textbox, so it will look like you dont have placeholder..

    ::-webkit-input-placeholder { /* WebKit browsers */
        color:    #fff;
    }
    :-moz-placeholder { /* Mozilla Firefox 4 to 18 */
       color:    #fff;
       opacity:  1;
    }
    ::-moz-placeholder { /* Mozilla Firefox 19+ */
       color:    #fff;
       opacity:  1;
    }
    :-ms-input-placeholder { /* Internet Explorer 10+ */
       color:    #fff;
    }
    

    Check the fiddle

提交回复
热议问题