HTML 占位符属性
htmlweb developmentfront end technology更新于 2024/5/23 11:24:17
HTML 占位符属性表示在用户开始输入任何内容之前,在 input/textarea 元素中显示的文本。
语法
以下是语法 −
<tagname placeholder=”text”></tagname>
让我们看一个 HTML 占位符属性的示例 −
示例
<!DOCTYPE html>
<html>
<style>
body {
color: #000;
height: 100vh;
background-color: #8BC6EC;
background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%);
text-align: center;
}
</style>
<body>
<h1>HTML placeholder Demo</h1>
<input type="text" placeholder='Enter your first name'>
<input type="text" placeholder='Enter your last name'>
</body>
</html>
输出

相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

