DOM Style 对象

Style 对象

The Style object represents an individual style statement. The Style object can be accessed from the document or from the elements to which that style is applied.
Style对象可代表一个单独的style声明。Style对象可被文档或是支持样式的元素所访问到。

Syntax for using the Style object properties:
使用Style对象属性的语法:

document.getElementById("id").style.property="value"

The Style object property categories:
Style对象的属性分类:

IE: Internet Explorer, M: Mac IE only, W: Windows IE only, F: Firefox, N: Netscape, W3C: World Wide Web Consortium (Internet Standard).

Background properties

Property
属性
Description
描述
Values
IEFN
backgroundSets or returns all background properties in one
设置或返回background属性
backgroundColor
backgroundImage
backgroundRepeat
backgroundAttachment
backgroundPosition
416
backgroundAttachmentSets or returns whether a background image is fixed or scrolls with the rest of the page
设置或返回背景图片的表现形式
scroll
fixed
416
backgroundColorSets or returns the background color of the element
设置或返回背景颜色
color-rgb
color-hex
color-name

transparent
416
backgroundImageSets or returns the background image of the element
设置或返回元素的背景图
url("URL")
none
416
backgroundPositionSets or returns the starting position of the background image
设置或返回背景图片的开始位置
top left
top center
top right
center left
center center
center right
bottom left
bottom center
bottom right
x-% y-%
x-pos y-pos
416
backgroundPositionXSets or returns the x-coordinates of the backgroundPosition property
设置或返回背景位置的X坐标
left
center
right
x-%
x-pos
4  
backgroundPositionYSets or returns the y-coordinates of the backgroundPosition property
设置或返回背景位置的Y坐标
top
center
bottom
y-%
y-pos
4  
backgroundRepeatSets or returns if/how a background image will be repeated
设置或返回背景是否重复显示,怎样重复显示
repeat
repeat-x
repeat-y
no-repeat
416

Border and Margin properties

Property
属性
Description
描述
Values
IEFN
borderSets or returns all properties for the four borders in one
设置或返回所有四边的属性
borderWidth
borderStyle
borderColor
416
borderBottomSets or returns all properties for the bottom border in one
设置或返回下边框的所有属性
borderWidth
borderStyle
borderColor
416
borderLeftSets or returns all property for the left border in one
设置或获取对象左边框的属性。
borderWidth
borderStyle
borderColor
416
borderRightSets or returns all property for the right border in one
设置或获取对象右边框的属性。
borderWidth
borderStyle
borderColor
416
borderTopSets or returns all property for the top border in one
设置或获取对象上边框的属性。
borderWidth
borderStyle
borderColor
416
borderBottomColorSets or returns the color of the bottom border
设置或获取对象下边框的属性。
borderColor416
borderLeftColorSets or returns the color of the left border
设置或获取对象左边框的颜色。
borderColor416
borderRightColorSets or returns the color of the right border
设置或获取对象右边框的颜色。
borderColor416
borderTopColorSets or returns the color of the top border
设置或获取对象上边框的颜色。
borderColor416
borderBottomStyleSets or returns the style of the bottom border
设置或获取对象下边框的样式。
borderStyle416
borderLeftStyleSets or returns the style of the left border
设置或获取对象左边框的样式。
borderStyle416
borderRightStyleSets or returns the style of the right border
设置或获取对象右边框的样式。
borderStyle416
borderTopStyleSets or returns the style of the top border
设置或获取对象上边框的样式。
borderStyle416
borderBottomWidthSets or returns the width of the bottom border
设置或获取对象下边框的宽度。
borderWidth416
borderLeftWidthSets or returns the width of the left border
设置或获取对象左边框的宽度。
borderWidth416
borderRightWidthSets or returns the width of the right border
设置或获取对象右边框的宽度。
borderWidth416
borderTopWidthSets or returns the width of the top border
设置或获取对象上边框的宽度。
borderWidth416
borderColorSets or returns the color of all four borders (can have up to four colors)
设置或获取对象的边框颜色。
color-rgb
color-hex
color-name
416
borderStyleSets or returns the style of all four borders
设置或获取对象上下左右边框的样式。
none
dotted
dashed
solid
double
groove
ridge
inset
outset
416
borderWidthSets or returns the width of all four borders
设置或获取对象上下左右边框的宽度。
thin
medium
thick
length
416
marginSets or returns the top, right, bottom, and left margins of the element
设置或获取对象的上下左右边距。
marginTop
marginRight
marginBottom
marginLeft
416
marginBottomSets or returns the bottom margin of the element
设置或获取对象的下边距宽度。
auto
length
%
416
marginLeftSets or returns the left margin of the element
设置或获取对象的左边距宽度。
auto
length
%
416
marginRightSets or returns the right margin of the element
设置或获取对象的右边距宽度。
auto
length
%
416
marginTopSets or returns the top margin of the element
设置或获取对象的上边距宽度。
auto
length
%
416
outlineSets or returns the color, style, and width of the outline around the element
设置或获取围绕元素的颜色,样式和边框宽度
outlineColor
outlineStyle
outlineWidth
5M16
outlineColorSets or returns the color of the outline around the element
设置或返回围绕元素的颜色
color-rgb
color-hex
color-name
invert
5M16
outlineStyleSets or returns the style of the outline around the element
设置或返回围绕元素的样式
none
dotted
dashed
solid
double
groove
ridge
inset
outset
5M16
outlineWidthSets or returns the width of the outline around the element
设置或返回围绕元素的边框宽度
thin
medium
thick
length
5M16
paddingSets or returns the top, right, bottom, and left padding of the element
设置或获取要在对象和其边距或若存在的边框的话就是对象和其边框之间要插入的全部空间。
paddingTop
paddingRight
paddingBottom
paddingLeft
416
paddingBottomSets or returns the bottom padding of the element
设置或获取要在对象下边框和内容之间插入的空间总量。
length
%
416
paddingLeftSets or returns the left padding of the element
设置或获取要在对象左边框和内容之间插入的空间总量。
length
%
416
paddingRightSets or returns the right padding of the element
设置或获取要在对象右边框和内容之间插入的空间总量。
length
%
416
paddingTopSets or returns the top padding of the element
设置或获取对象上边框和内容之间插入的空间总量。
length
%
416

Layout properties

Property
属性
Description
描述
Values
IEFN
clearSets or returns which sides of an element other floating elements are not allowed
设置或获取对象是否允许在其左侧、右侧或两边放置浮动对象,以防下段文本显示在浮动对象上。
left
right
both
none
416
clipSets or returns the shape of an element. What if an image is larger than the element it goes inside? - This property lets you specify the dimensions of an element that should be visible, and the element is clipped into this shape, and displayed
设置或获取定位对象的哪个部分可见。
auto
rect(top right bottom left)
416
clipBottomReturns the bottom coordinate of the clipping regionauto
length
5W16
clipLeftReturns the left coordinate of the clipping regionauto
length
5W16
clipRightReturns the right coordinate of the clipping regionauto
length
5W16
clipTopReturns the top coordinate of the clipping regionauto
length
5W16
contentSets or returns meta-information
设置或返回meta信息
 5M16
counterIncrement  5M16
counterReset  5M16
cssFloat  5M16
cursorSets or returns the type of cursor to be displayed when the mouse pointer moves over the element
设置或获取当鼠标指针指向对象时所使用的鼠标指针。
auto
crosshair
default
hand
pointer
move
e-resize
ne-resize
nw-resize
n-resize
se-resize
sw-resize
s-resize
w-resize
text
wait
help
all-scroll (IE6+)
col-resize (IE6+)
no-drop (IE6+)
not-allowed (IE6+)
pointer (IE6+)
progress (IE6+)
row-resize (IE6+)
url(uri) (IE6+)
vertical-text (IE6+)
416
directionSets or returns the reading order
设置或获取对象的阅读顺序。
ltr
rtl
516
displaySets or returns how/if an element is displayed
设置或获取对象是否要渲染。
block
none
inline
inline-block
list-item (IE6+)
table-header-group
table-footer-group
416
filterSets or returns the filter/filters applied to the element
设置或返回元素是否需要应用滤镜
 4W  
layoutGrid  5W  
layoutGridChar  5W  
layoutGridLine  5W  
layoutGridMode  5W  
layoutGridType  5W  
markerOffset  5M16
marks  5M16
maxHeight  5M16
maxWidth  5M16
minHeight  616
minWidth  5M16
MozOpacity   16
overflow  416
overflowX  5W16
overflowY  5W16
styleFloat  4  
verticalAlign  416
visibility  416
width  416
zoom  5W  

List properties

Property
属性
Description
描述
Values
IEFN
listStyleSets or returns all the properties for a list in one
设置或获取对象最多三个独立的 listStyle 属性。
listStyleType
listStylePosition
listStyleImage
416
listStyleImageSets or returns the value of the image that is the list-item marker
获取要为对象应用的列表项目符号的图像。
none
url(url)
416
listStylePositionSets or returns where the list-item marker is placed in the list
获取相对于对象内容如何绘制项目符号。
outside
inside
416
listStyleTypeSets or returns the type of the list-item marker
获取对象预定义的项目符号类型。
disc
circle
square
decimal
lower-roman
upper-roman
lower-alpha
upper-alpha
none
416

Misc properties

Property
属性
Description
描述
Values
IEFN
acceleratorSets or returns a Boolean value indicating whether the element contains an accelerator key
设置或获取表明对象是否包含快捷键的字符串。
false
true
5W  
behavior  5W  
cssText  416
imeMode  5W  

Positioning properties

PropertyDescriptionValuesIEFN
bottom  516
height  416
left  416
pixelBottom  4  
pixelHeight  4  
pixelLeft  4  
pixelRight  4  
pixelTop  4  
pixelWidth  4  
posBottom  4  
posHeight  4  
posLeft  4  
posRight  4  
posTop  4  
posWidth  4  
position  416
right  516
top  416
width  416
zIndex  416

Printing properties

PropertyDescriptionValuesIEFN
orphans  5M16
widows  5M16
page  5M16
pageBreakAfter  416
pageBreakBefore  416
pageBreakInside  5M16
size   16

Scrollbar properties

PropertyDescriptionValuesIEFN
scrollbar3dLightColor  5W  
scrollbarArrowColor  5W  
scrollbarBaseColor  5W  
scrollbarDarkShadowColor  5W  
scrollbarFaceColor  5W  
scrollbarHighlightColor  5W  
scrollbarShadowColor  5W  
scrollbarTrackColor  5W  

Table properties

PropertyDescriptionValuesIEFN
borderCollapse  5M16
borderSpacing  5M16
captionSide  5M16
emptyCells  5M16
tableLayout  516

Text properties

PropertyDescriptionValuesIEFN
color  416
font  416
fontFamily  416
fontSize  416
fontSizeAdjust  5M16
fontStretch  5M16
fontStyle  416
fontVariant  416
fontWeight  416
letterSpacing  416
lineBreak  5  
lineHeight  416
quotes  5M16
rubyAlign  5  
rubyOverhang  5  
rubyPosition  5  
textAlign  416
textAlignLast  5  
textAutospace  5W  
textDecoration  416
textDecorationBlink  4  
textDecorationLineThrough  4  
textDecorationLineNone  4  
textDecorationLineOverline  4  
textDecorationLineUnderline  4  
textIndent  416
textJustify  5  
textJustifyTrim  5  
textKashidaSpace  5  
textOverflow  6W  
textShadow  5M16
textTransform  416
textUnderlinePosition  5  
unicodeBidi  516
whiteSpace  416
wordBreak  5W  
wordSpacing  616
wordWrap  5W  
writingMode  5W  
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值