CSS样式的补充:如何设置文本框内的默认文字?

如何设置文本框内的默认文字?

效果如图:

 下面是源代码。

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>placeholder属性</title>
	</head>
	<body>
		<input type="text" placeholder="点击搜索" />
	</body>
</html>

单行文本框

语法:

<input type="text"  />

placeholder属性

设置文本框内默认文字

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>placeholder属性</title>
	</head>
	<body>
		<input type="text" placeholder="在这里设置默认文字" />
	</body>
</html>

效果图:

猜你喜欢

转载自blog.csdn.net/ydc222/article/details/127390899