placeholder属性作用

placeholder属性作用

1.介绍
该提示会在输入字段为空时显示,并会在字段获得焦点时消失。
注释:placeholder 属性适用于以下的 <input> 类型:text, search, url, telephone, email 以及 password。
  • 示图:

image

<!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.0">
    <title>Document</title>
</head>

<body>
    <b>注意:password 里面使用:value属性:默认值会变成小黑点。</b>
    <br>
    <p>placeholder="请输入密码"效果如下:</p>
    <p>password:<input type="password" placeholder="请输入密码" maxlength="18"></p>
    <br>
    <p>value="请输入密码"效果如下:</p>
    <p>password:<input type="password" value="请输入密码" maxlength="18"></p>
</body>

</html>
posted @ 2022-04-09 21:58  AlexEvans  阅读(519)  评论(0编辑  收藏  举报