使用 CSS 为表单输入添加背景颜色

王林
王林 转载
2023-09-17 13:01:02 772浏览

使用 CSS 为表单输入添加背景颜色

要向表单输入添加背景颜色,请使用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 为表单输入添加背景颜色的详细内容,更多请关注php中文网其它相关文章!

声明:本文转载于:tutorialspoint,如有侵犯,请联系admin@php.cn删除