"; 2. Use the button tag, the syntax is "" ."/> "; 2. Use the button tag, the syntax is "" .">

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

How to write button in html

WBOY
WBOYOriginal
2021-11-11 14:29:3323036browse

How to write the html button: 1. Use the input tag, the syntax is ""; 2. Use the button tag, the syntax is "Button text".

How to write button in html

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

How to write the html button:

##1. Use the input tag

<input type="button" value="保存"/>

According to different type attribute values, the input field has many forms. Input fields can be text fields, checkboxes, masked text controls, radio buttons, buttons, etc.

A simple HTML form, including two text input boxes and a submit button:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>button</title>
</head>
<body>
<form action="form_action.asp" method="get">
  First name: <input type="text" name="fname" />
  Last name: <input type="text" name="lname" />
  <input type="submit" value="Submit" />
</form>
</body>
</html>

Output result:


How to write button in html

2. Use the button tag

<button>保存</button>

tags is the content of the button, including any acceptable body content, such as text or multimedia content. For example, we can include an image and associated text in a button and use them to create an attractive markup image in the button.

If you use the button element in an HTML form, different browsers will submit different button values. Please use input elements to create buttons in HTML forms.

The only prohibited element is the image map, as its mouse and keyboard-sensitive actions interfere with the behavior of the form buttons.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>button</title>
</head>
<body>
<button type="button">Click Me!</button>
</body>
</html>

Output result:


How to write button in html

For more programming-related knowledge, please visit:

Programming Video! !

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