How to write css picture button code

WBOY
Release: 2021-12-03 16:52:07
Original
5388 people have browsed it

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>
Copy after login

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!

Related labels:
css
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!