使用 CSS 为表单输入框添加背景颜色
cssweb developmentfront end technology更新于 2024/7/11 2:20:17
要为表单输入框添加背景颜色,请使用 background-color属性。
您可以尝试运行以下代码,为表单添加背景颜色属性
示例
<!DOCTYPE html>
<html>
<head>
<style>
input[type=text] {
width: 100%;
padding: 10px 15px;
margin: 5px 0;
box-sizing: border-box;
background-color: gray;
}
</style>
</head>
<body>
<p>Fill the below form,</p>
<form>
<label for = "subject">Subject</label>
<input type = "text" id = "subject" name = "sub">
<label for = "student">Student</label>
<input type = "text" id = "student" name = "stu">
</form>
</body>
</html>
相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

