您的位置:首页 > 其它

如何给div添加placeholder属性

2017-06-01 13:53 387 查看
<!DOCTYPE <html>  

<head>  

    <title></title>  

    <style type="text/css">  

        .input{  

            width:200px;  

            height:30px;  

            border:1px solid grey;  

        }  

        .input:empty::before{  

            color:lightgrey;  

            content:attr(placeholder);  

        }  

    </style>  

</head>  

<body>  

    <div class="input" contenteditable placeholder="请输入文字"></div>  

</body>  

</html>  

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: