How to modify the css style of the placeholder font

Modify the css style of the text in the palceholder

 ::-webkit-input-placeholder{
     color: red;
     font-size: 20px;
     line-height: 50px;
 }

Modify the css style of the text in the palceholder with the class name

test1.test1::- webkit-input-placeholder{
    color: red;
    font-size: 20px;
    line-height: 50px;
}

example:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            input{
                height: 50px;
                font-size: 14px;
                line-height: 50px;
            }

            .test1::-webkit-input-placeholder{
                color: red;
                font-size: 20px;
                line-height: 50px;
            }
            
        </style>
    </head>
    <body>
        <input class="test1" type="text" placeholder="测试" />
        <input type="text" placeholder="测试" />
    </body>
</html>

 For compatibility, add the corresponding browser prefix

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326395677&siteId=291194637