如何使用JS来改变CSS样式

来源:互联网 发布:矩阵qr分解应用 编辑:程序博客网 时间:2024/04/29 08:06


方法:

document.getElementById("xx").style.xxx中的所有属性是什么

盒子标签和属性对照CSS语法(不区分大小写)JavaScript语法(区分大小写)borderborderborder-bottomborderBottomborder-bottom-colorborderBottomColorborder-bottom-styleborderBottomStyleborder-bottom-widthborderBottomWidthborder-colorborderColorborder-leftborderLeftborder-left-colorborderLeftColorborder-left-styleborderLeftStyleborder-left-widthborderLeftWidthborder-rightborderRightborder-right-colorborderRightColorborder-right-styleborderRightStyleborder-right-widthborderRightWidthborder-styleborderStyleborder-topborderTopborder-top-colorborderTopColorborder-top-styleborderTopStyleborder-top-widthborderTopWidthborder-widthborderWidthclearclearfloatfloatStylemarginmarginmargin-bottommarginBottommargin-leftmarginLeftmargin-rightmarginRightmargin-topmarginToppaddingpaddingpadding-bottompaddingBottompadding-leftpaddingLeftpadding-rightpaddingRightpadding-toppaddingTop颜色和背景标签和属性对照CSS 语法(不区分大小写)JavaScript 语法(区分大小写)backgroundbackgroundbackground-attachmentbackgroundAttachmentbackground-colorbackgroundColorbackground-imagebackgroundImagebackground-positionbackgroundPositionbackground-repeatbackgroundRepeatcolorcolor 样式标签和属性对照CSS语法(不区分大小写)JavaScript 语法(区分大小写)displaydisplaylist-style-typelistStyleTypelist-style-imagelistStyleImagelist-style-positionlistStylePositionlist-stylelistStylewhite-spacewhiteSpace 文字样式标签和属性对照CSS 语法(不区分大小写)JavaScript 语法(区分大小写)fontfontfont-familyfontFamilyfont-sizefontSizefont-stylefontStylefont-variantfontVariantfont-weightfontWeight 文本标签和属性对照CSS 语法(不区分大小写)JavaScript 语法(区分大小写)letter-spacingletterSpacingline-breaklineBreakline-heightlineHeighttext-aligntextAligntext-decorationtextDecorationtext-indenttextIndenttext-justifytextJustifytext-transformtextTransformvertical-align

verticalAlign 

0 0