首页 > 技术文章 > 前端 html input标签 placeholder属性 标签上显示内容

mingerlcm 2018-10-23 23:29 原文

 

 

 

 

前端 html  input标签 的placeholder属性  标签上显示内容

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div style="width: 600px;margin: auto">
        <input  type="text" placeholder="请输入关键字">
    </div>


</body>
</html>

 

 

一输入文本内容 没有了

 

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="x-ua-compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Title</title>
</head>
<body>
    <div>
        <form>
            <div>
                <label for="user">用户名:</label>
                <input id="user" name="username" type="text" placeholder="请输入用户名">
            </div>

            <div>
                <label for="pwd">密码:</label>
                <input id="pwd" name="password" type="password" placeholder="请输入密码">
            </div>
        </form>
    </div>
</body>
</html>

 

 

推荐阅读