Home >Web Front-end >HTML Tutorial >How to set image as background in jsp

How to set image as background in jsp

anonymity
anonymityOriginal
2019-05-29 15:40:3513788browse

How to set a picture as the background in jsp? There are two solutions.

How to set image as background in jsp

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!

Statement:
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
Previous article:How to hide div in jspNext article:How to hide div in jsp