Home  >  Article  >  Web Front-end  >  How to set image button in html

How to set image button in html

藏色散人
藏色散人Original
2021-06-03 15:28:368561browse

htmlHow to set a picture button: first create an HTML sample file; then create a button through the button tag; and finally set the picture through the background attribute.

How to set image button in html

The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.

Turn pictures into buttons in html

The code is as follows:

<input type="image">
<input type="submit" style="background: url(&#39;图&#39;) no-repeat;">
<input type="button" style="background: url(&#39;图&#39;) no-repeat;" οnclick="提交的js">
<button style="background: url(&#39;图&#39;) no-repeat;" οnclick="提交的js">文字</button>
<img  src="图" οnclick="提交的js" alt="How to set image button in html" >
<span style="border:1px solid #000000;background: url(&#39;图&#39;) no-repeat;" οnclick="提交的js"> </span>

Related introduction:

tag To collect user information.

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.

Background shorthand property sets all background properties in one declaration.

You can set the following properties:

background-color

background-position

background-size

background-repeat

background-origin

background-clip

background-attachment

background-image

If one of the values ​​is not set, it will not There will be problems, such as background:#ff0000 url('smiley.gif'); is also allowed.

It is generally recommended to use this attribute instead of using individual attributes separately, because this attribute is better supported in older browsers and requires fewer letters to be typed.

How to set image button in html

【Recommended learning: html video tutorial

The above is the detailed content of How to set image 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
Previous article:How to add a line in htmlNext article:How to add a line in html