Home>Article>Web Front-end> How to set button size and color in html

How to set button size and color in html

青灯夜游
青灯夜游 Original
2021-03-05 17:16:42 19363browse

In HTML, you can use the width and height attributes to set the size of the button element, and use the background-color attribute to set the color of the button element. The specific syntax is "button{width: width value; height: height value ;background-color: color value;}".

How to set button size and color in html

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

HTML

Inside the

htmlSet button size and color

     

Rendering:

How to set button size and color in html

css width and height Properties

width property sets the width of the element.

The height attribute sets the height of the element.

Value Description
auto Default value. The browser can calculate the actual width or height.
length Define width or height using units such as px, cm, etc.
% # Defines a percentage width or height based on the width of the containing block (parent element).

CSS background-color property

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

Specifies the background color. transparent Specifies that the background color should be transparent. This is the default
Value Description
##color
[Recommended tutorial:

CSS video tutorial]

The above is the detailed content of How to set button size and 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
Previous article:How to set scroll bar Next article:How to set scroll bar