举报投诉联系我们 手机版 热门标签 名动网
您的位置:名动网 > html style background HTML DOM Style backgroundRepeat 属性

html style background HTML DOM Style backgroundRepeat 属性

2023-05-04 02:20

html style background HTML DOM Style backgroundRepeat 属性

html style background HTML DOM Style backgroundRepeat 属性

html style background

Style backgroundRepeat 属性

Style 对象参考手册 Style 对象

定义和用法

backgroundRepeat 属性设置或返回如何重复背景图像。

语法

设置 backgroundRepeat 属性:

Object.style.backgroundRepeat="repeat|repeat-x|repeat-y|no-repeat|inherit"

返回 backgroundRepeat 属性:

Object.style.backgroundRepeat

描述
repeat默认。垂直和水平方向重复背景图像。
repeat-x水平方向重复背景图像。
repeat-y垂直方向重复背景图像。
no-repeat不重复背景图像。
inheritbackground-repeat 属性的设置从父元素继承。


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持 backgroundRepeat 属性。

注意:IE7 及更早的版本不支持 "inherit" 值。IE8 只有规定了 !DOCTYPE 才支持 "inherit"。IE9 支持 "inherit"。


实例

实例

设置背景图像为垂直方向重复:

<html>
<head>
<style type="text/css">
body
{
background:#f3f3f3 url('img_tree.png');
}
</style>
<script>
function displayResult()
{
document.body.style.backgroundRepeat="repeat-y";
}
</script>
</head>
<body>

<button type="button" onclick="displayResult()">Repeat vertically</button>
<br>

<h1>Hello !</h1>
<p>这是一个段落。</p>

</body>
</html>



Style 对象参考手册 Style 对象
阅读全文
以上是名动网为你收集整理的html style background HTML DOM Style backgroundRepeat 属性全部内容。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。
相关文章
© 2024 名动网 mdwl.vip 版权所有 联系我们