How to change button color in html

WBOY
Release: 2021-11-12 18:49:17
Original
26576 people have browsed it

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:颜色值}
Copy after login

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>
Copy after login

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:颜色值}
Copy after login

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template