The content of this article is about how to set the background image with css? (Code example) has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
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 The 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 alternative The 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>
This method is better because it can be displayed normally under IE or FF.
The above is to set the background image with css How to achieve? (Code examples) full introduction, if you want to know more about CSS3 tutorial, please pay attention to the PHP Chinese website.
The above is the detailed content of How to set background image with css? (code example). For more information, please follow other related articles on the PHP Chinese website!