Latest web development tutorials

HTML DOM Style backgroundClip 屬性

Style 對象參考手冊 Style對象

實例

指定背景的繪製區域:

document.getElementById("myDIV").style.backgroundClip="content-box";

嘗試一下»

定義和用法

background-clip 屬性設置或返回背景的繪製區域。


瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 9+、Firefox、Opera、Chrome 和Safari 支持backgroundClip 屬性。

注意: Internet Explorer 8及其之前的版本不支持backgroundClip屬性。


語法

返回backgroundClip 屬性:

object .style.backgroundClip

設置backgroundClip 屬性:

object .style.backgroundClip="border-box|padding-box|content-box|initial|inherit"

屬性值

描述
border-box 默认值。背景按边界框进行剪裁。
padding-box 背景按填充框进行剪裁。
content-box 背景按内容框进行剪裁。
initial 设置该属性为它的默认值。请参阅 initial
inherit 从父元素继承该属性。请参阅 inherit

技術細節

默認值: border-box
返回值: 字符串,表示元素的background-clip 屬性。
CSS 版本 CSS3


相關文章

CSS參考手冊: background-clip屬性


Style 對象參考手冊 Style對象