How to set background image for button in css
Nov 26, 2021 pm 04:40 PMIn CSS, you can use the "background-image" attribute to set a background image for the button. The function of this attribute is to set the background image of the element. You only need to add "background:url("image path" to the button element );" style is enough.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
How to set the background image for the button in css
In css, you can use the background-image attribute to set the background image of the button. This attribute Sets a background image for the element.
Let’s take an example to see how to set the button background image through the background-image attribute. The example is as follows:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> button { width:200px; height:150px; background-image:url("1118.02.png"); } </style> </head> <body> <button type="button" >按钮</button> </body> </html>
Output result:
(Learning video sharing: css video tutorial)
The above is the detailed content of How to set background image for button in css. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

What language is the browser plug-in written in?
