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

How to set button color in html

青灯夜游
青灯夜游Original
2021-06-21 17:37:4321762browse

In HTML, you can use the style attribute on the button button element, add the "background-color: color value;" style to set the background color of the button, and add the "color: color value;" style to set the button font color.

How to set button color in html

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

Set the background color of the button in html

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
	</head>
	<body>
		<button>按钮1</button>
		<button style="background-color: #FFC0CB;">按钮2</button>

	</body>
</html>

Rendering:

How to set button color in html

Description:

The background-color property sets the background color of the element.

The background-color property sets a solid color for the element. This color fills the element's content, padding, and border areas, extending to the outer bounds of the element's border (but not the margins). If the border has transparent parts (such as a dotted border), the background color will show through these transparent parts.

Set the font color of the button in html

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
	</head>
	<body>
		<button>按钮1</button>
		<button style="color: blueviolet;">按钮2</button>

	</body>
</html>

Rendering:

How to set button color in html

Description:

The color attribute specifies the color of the text.

This attribute sets the foreground color of an element (in HTML representation, the color of the element's text); raster images are not affected by color. This color also applies to all borders of the element, unless overridden by border-color or another border-color property.

Recommended tutorials: "html video tutorial", "css video tutorial"

The above is the detailed content of How to set 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