Home >Web Front-end >HTML Tutorial >How to change button color in html

How to change button color in html

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2021-11-12 18:49:1726753browse

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.

How to change button color in html

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:

How to change button color in html

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:

How to change button color in html

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn