Home >Web Front-end >CSS Tutorial >How to implement css button background image? (code example)

How to implement css button background image? (code example)

云罗郡主
云罗郡主forward
2018-10-29 15:55:156082browse

How to implement css button background image? I believe that many friends who have just come into contact with CSS will have such questions. This chapter will introduce to you how to implement css button background images. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

How to implement css button background image? (code example)

Many people like to use a picture as a submit button when submitting a form. Most people may use JS to operate the form submission, that is, when the user clicks on the picture, it will respond. A JS to submit the form. In fact, there is another way, which is to directly set the image background of the SUBMIT button. There are two ways to set its image background. One is to set it directly in the button, as follows:

<input type="submit" name="submit_button" value="" style="background:url(imagepath) no-repeat" />

This setting method is visible under FF, but not under IE. I don’t know why. Anyway, it was not visible under IE when I tested it. It won’t work if I change it to this: background-image\backgroundimage;

Another method is to use CSS to set it. The implementation method is as follows:

<style type="text/css">
    .submitStyle {background:url(imagpath);border:0px}
</style>

The above is a complete introduction to how to implement the css button background image. If you want to know more about CSS3 video tutorial, please pay attention to the PHP Chinese website.


The above is the detailed content of How to implement css button background image? (code example). For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:lvyestudy.com. If there is any infringement, please contact admin@php.cn delete