HTML <body> background 属性
标签" href="tag-main.html"><main>
<map>
<mark>
<menu>
<meta>
<meter>
<nav>
<noframes>
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<html>
<picture>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike>
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<textarea>
< template>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt>
<u>
<ul>
<var>
<video>
<wbr>
HTML <body> background 属性
实例
为文档规定一幅背景图像:
<html>
<body background="bg.gif">
<h1>Hello world!</h1>
<p><a href="http://www.runoob.com">访问菜鸟教程!</a></p>
</body>
</html>
<body background="bg.gif">
<h1>Hello world!</h1>
<p><a href="http://www.runoob.com">访问菜鸟教程!</a></p>
</body>
</html>
浏览器支持
所有主流浏览器都支持 background 属性。
定义和用法
HTML5 已不再支持 <body> background 属性。请使用 CSS 替代。
<body> 的 background 属性 在 HTML 4.01 中已废弃。
background 属性规定规定文档的背景图像。
兼容性注释
在 HTML 4.01 中,不赞成使用 body 元素的 background 属性;在 XHTML 1.0 Strict DTD 中,不支持 body 元素的 background 属性。请使用 CSS 代替。
CSS 语法: <body style="background-image:url(bgimage.jpg)">
在我们的 CSS 教程中,您可以找到更多有关 background-image属性的知识。
语法
<body background="URL">
属性值
| 值 | 描述 |
|---|---|
| URL |
背景图像的 URL。可能的值:
|
HTML <body> 标签