HTML buttons add image background and hyperlinks

(1) Add image background

{1} There are two methods for adding buttons: button and input

① Use the <button> tag to add a button to the html <button type="button">Click Me!</button>

②Use the input method <input type ="button" style="width:100px;height:60px;" value="Let's Go">
type: description button button style: edit button size value: button key character content display

{ difference: inside the button element, you can Place content, such as text or images. This is the difference between this element and a button created with an input element, of course buttons can also be edited in size}

{2}Adding an image

Adding an image is adding an image tag (<img>) and a source attribute (Src)
<img > is an empty tag, contains only attributes, and has no closing tag. To display an image on the page, the source attribute (src) is required. src refers to source. The value of the source property is the URL address of the image.
If the image named "boat.png" is located in the images directory of www.baidu.com.cn, then its URL is http://www.baidu.com.cn/images/boat.png
The syntax for defining the image is: <img src="url" />





  <input type=button onclick="location.href('连接')">
</a>

②button方法添加超链接
<a href=" 超链接">
         <button type="button" style="width: 100px;height: 60px;">Good</button>
</a>




Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326870917&siteId=291194637