添加颜色的方法:1、利用color属性给input元素添加字体颜色,语法为“color:颜色值;”;2、利用“background-color”属性给input元素添加背景颜色,语法为“background-color:颜色值;”。
本教程操作环境:windows7系统、css3&&html5版、dell g3电脑。
css中怎么给input加颜色
可以利用color属性给input元素添加字体颜色,利用background-color属性给input元素添加背景颜色。
示例如下:
<!doctype html><html lang="en"><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>document</title> <style> input{ color:#ffffff; background-color:#000000; } </style></head><body> <input type="text"></body></html>
输出结果:
(学习视频分享:css视频教程)
以上就是css中怎么给input加颜色的详细内容。