htmlHow to change the button color: 1. Add the "button{background-color:color value}" style to the button element to change the background color of the button; 2. Add "button{color:color value} to the element button }" style changes the font color of the button.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
html method to change button color
1. html method to change background color
The code is as follows:
button{background-color:颜色值}
Set the 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>
Output result:
2. How to change the font color of the button in html
The code is as follows:
button{color:颜色值}
Set the font 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>
Output result:
More programming related For knowledge, please visit: programming video! !
The above is the detailed content of How to change button color in html. For more information, please follow other related articles on the PHP Chinese website!