在style中插入背景图片html
时间: 2023-11-18 14:02:18 浏览: 25
要在 HTML 的样式中插入背景图片,你可以使用 CSS 的 `background-image` 属性。以下是一个示例:
```html
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-image: url("your-image.jpg");
background-repeat: no-repeat; /* 控制图片是否重复 */
background-size: cover; /* 控制图片如何适应背景 */
}
</style>
</head>
<body>
<!-- 这里是页面内容 -->
</body>
</html>
```
请将 `"your-image.jpg"` 替换为你要使用的实际图片的路径。这将把指定的图片设置为页面的背景。你还可以根据需要调整其他的背景属性,例如 `background-repeat` 和 `background-size`。