CSS Input field text color of inputted text

后端 未结 5 1735
渐次进展
渐次进展 2020-12-13 17:08

I have an input field, and the color of the text in it is black. (I\'m using jquery.placeholder) Let\'s say the text in there is \"E-Mail\"

When you click on this fi

5条回答
  •  没有蜡笔的小新
    2020-12-13 17:29

    Change your second style to this:

    input, select, textarea{
        color: #ff0000;
    }
    

    At the moment, you are telling the form to change the text to black once the focus is off. The above remedies that.

    Also, it is a good idea to place the normal state styles ahead of the :focus and :hover styles in your stylesheet. That helps prevent this problem. So

    input, select, textarea{
        color: #ff0000;
    }
    
    textarea:focus, input:focus {
        color: #ff0000;
    }
    

提交回复
热议问题