backgroundRepeat 属性设置背景图像是否及如何重复。
</>code
- Object.style.backgroundRepeat=repeat_value
参数 | 描述 |
---|---|
repeat | 默认。背景图像将在垂直方向和水平方向重复。 |
repeat-x | 背景图像将在水平方向重复。 |
repeat-y | 背景图像将在垂直方向重复。 |
no-repeat | 背景图像将仅显示一次。 |
本例仅在 y 轴重复背景图像:
</>code
- <html>
- <head>
- <style type="text/css">
- body
- {
- background-color:#FFCC80;
- background-image:url(bgdesert.jpg);
- }
- </style>
- <script type="text/javascript">
- function changeRepeat()
- {
document.body.style.backgroundRepeat="repeat-y";
- }
- </script>
- </head>
- <body>
- <input type="button" onclick="changeRepeat()"
- value="Repeat background-image only on the y-axis" />
- </body>
- </html>
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛
Powered by 365建站网 RSS地图 HTML地图
copyright © 2013-2024 版权所有 鄂ICP备17013400号