html改变按钮颜色的方法:1、给按钮元素添加“button{background-color:颜色值}”样式改变按钮的背景颜色;2、给元素按钮添加“button{color:颜色值}”样式改变按钮的字体颜色。
本教程操作环境:windows7系统、css3&&html5版、dell g3电脑。
html改变按钮颜色的方法
1、html改变背景颜色的方法
代码如下:
button{background-color:颜色值}
设置背景颜色:
<!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></head><style> button{background-color:#ff0000}</style><body> <button>按钮</button></body></html>
输出结果:
2、html改变按钮字体颜色的方法
代码如下:
button{color:颜色值}
设置字体颜色:
<!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></head><style> button{color:#ff0000}</style><body> <button>按钮</button></body></html>
输出结果:
更多编程相关知识,请访问:编程视频!!
以上就是html怎么改变按钮颜色的详细内容。