Home > Article > Web Front-end > How to set image as background in jsp
How to set a picture as the background in jsp? There are two solutions.
First place the image in the img folder. img is placed in the WebRoot of MyEclipse, otherwise the path may be incorrect.
(1):
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body background="img/1.jpg"> </body> </html>
(2):
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <style> .b{background-image:url(img/1.jpg)} </style> </head> <body Class="b"> </body> </html>
You can also write the css separately, and you can use the link to call the name of the css no matter what page is used. That's it.
The above is the detailed content of How to set image as background in jsp. For more information, please follow other related articles on the PHP Chinese website!