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

How to set background image with css? (code example)

云罗郡主
Release: 2018-11-10 15:02:27
forward
2595 people have browsed it

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.

How to set background image with css? (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" />
Copy after login

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

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!

Related labels:
source:lvyestudy.com
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