Home  >  Article  >  Web Front-end  >  How to write css picture button code

How to write css picture button code

WBOY
WBOYOriginal
2021-12-03 16:52:075463browse

The background-image attribute can be used to achieve the picture button effect in css. The writing method is "button element {background-image:url (picture path)}"; the background-image attribute is used to set the background image of the element. Use this Just add a background image to the button element using the attribute.

How to write css picture button code

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

How to write css picture button code

In css, we can use the background-image attribute to set the picture button, background-image uses For setting the background image of an element.

You only need to add the background-image:url (picture path) style to the button element.

Let’s take a look at the specific operations through examples. The examples are 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:100px;
        border-radius:20px;
        border:1px solid #000000;
        background-image:url(1118.02.png);
        }
    </style>
</head>
<body>
    <button></button>
</body>
</html>

Output results:

How to write css picture button code

(Learning video sharing: css video tutorial)

The above is the detailed content of How to write css picture button code. 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 select tags in cssNext article:How to select tags in css