文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>javascript css

javascript css

时间:2007-07-17  来源:shiwudao

使用css指定HTML元素的 style时有时和用javascript指定时使用的名称不一致。比如javasript不接受带有-的名称,对照表如下。  

JavaScript Style Attributes

Listed below are the tables of CSS properties for various HTML element style attributes. I have added a column indicating the javaScript name that the browser recognizes for these properties. I have only listed those that I know work, but the trend seems to be to use the same name when one name is the style descriptor. When there are two names, use the first name in lower case and the first character of the second name in upper case. Examples:

  • color = color
  • background-color = backgroundColor
  • font-style = fontStyle
  • font-weight = fontWeight

Box Properties

Name JavaScript Name Description Possible Values Element Types Example inherited
border Sets border width, style and color. See border width, style, and color All {border: medium solid green} No
border-bottom Set the bottom border width style, and color. See border width, style, and color All {border-bottom: medium solid green} No
border-bottom-width Set the bottom border width thin, medium, thick, or length value All {border-bottom-width: thin} No
border-color Set the border color A color value, color, #RRGGBB All {border: #0000ff} No
border-left Set the left border width style, and color. See border width, style, and color All {border-left: medium solid green} No
border-left-width Set the left border width thin, medium, thick, or length value All {border-left-width: thin} No
border-right Set the right border width style, and color. See border width, style, and color All {border-right: medium solid green} No
border-right-width Set the right border width thin, medium, thick, or length value All {border-right-width: thin} No
border-style Sets border style none, dotted, dashed, solid, double, groove, ridge, inset, outset All {border: dashed} No
border-top Set the top border width style, and color. See border width, style, and color All {border-top: medium solid green} No
border-top-width Set the top border width thin, medium, thick, or length value All {border-top-width: thin} No
border-width Sets Border width. thin, medium, thick, or length value All {border-width: 8} No
clear Determines where floating elements are allowed. none, left, right, both All {clear: left} No
float Specifies how text is wrapped and where it is aligned. none, left, right All {float: left} No
height Height of element auto or a height value Block elements and IMG, INPUT, TEXTAREA, SELECT, and OBJECT {IFRAME name=google_ads_frame marginWidth=0 marginHeight=0 src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-0057014352875780&amp;dt=1184648081915&amp;lmt=1139728442&amp;format=120x600_as&amp;output=html&amp;correlator=1184648081905&amp;channel=2584929872&amp;url=http%3A%2F%2Fwww.comptechdoc.org%2Findependent%2Fweb%2Fcgi%2Fjavamanual%2Fjavastyle.html&amp;color_bg=EBFFED&amp;color_text=6F6F6F&amp;color_link=0000CC&amp;color_url=008000&amp;color_border=A8DDA0&amp;cc=2687&amp;flash=9&amp;u_h=1024&amp;u_w=1280&amp;u_ah=1024&amp;u_aw=1280&amp;u_cd=32&amp;u_tz=480&amp;u_his=1&amp;u_java=true" frameBorder=0 width=120 scrolling=no height=600 allowTransparency></IFRAME>

Products & Suppliers Service Providers A Company by Name THE ENGINEERING WEB All Sites Application Notes Material Properties Part Numbers (Beta) Patents Standards Supplier Web Sites

Background and Color Properties

Name JavaScript Name Description Possible Values Element Types Example inherited
background Set background color, repeat, image, attachment, or position. See background-color, background-image, background-attachment, background-repeat, background-position All {background: #8080ff} No
background-attachment Determines if the background image is fixed or scroll. scroll, fixed All {background-attachment: scroll} No
background-color backgroundColor Sets the background color. Named or value color All {background-color: #8080ff} No
background-image Sets the background image. url All {background-image: url('../../../../gifs/flowers.gif')} No
background-position Sets the background image initial position. top, center, bottom, left, center, right, or percent values Block and IMG, INPUT, TEXTAREA, SELECT, and OBJECT {background-position: left top} No
background-repeat Sets how the background image is repeated. repeat, repeat-x, repeat-y, no-repeat All {background-repeat: no-repeat} No
color color Sets element color. Named or value color All {color: green} Yes

Classification Properties

Name JavaScript Name Description Possible Values Element Types Example inherited
display Sets the type of element. block, inline, list-item, none All {display: list-item} No
list-style listStyle Sets list style type and/or position. See list-style-type and list-style-position List-item {list-style: circle} Yes
list-style-image Sets image to be used as the list item marker. url List-item {list-style-image: url(this.gif)} Yes
list-style-type Sets list style type. circle, disc, decimal, lower-alpha, lower-roman, none, square, upper-alpha, upper-roman List-item {list-style-type: square} Yes
list-style-position Sets where the marker is place relative to the text and its wrapping position. inside, outside List-item {list-style: circle} Yes
whitespace Sets treatment of spaces inside the element. normal, pre, nowrap Block {whitespace: pre} Yes

Font Properties

Name JavaScript Name Description Possible Values Element Types Example inherited
font Used to define font properties See font-family, font-size, font-style, font-variant, and font-weight. All {font: 20pt} Yes
font-family fontFamily Used to define font family to use family name All {font-family: ariel roman} Yes
font-size Used to define font size to use xx-small, x-small, small, medium, large, x-large, xx-large, larger, smaller, length value, or percent value All {font-size: 18pt} Yes
font-style fontStyle Used to define font style to use normal, italic, oblique All {font-style: italic} Yes
font-variant fontVariant Used to determine whether to use normal or small caps normal, small-caps All {font-variant: small-caps} Yes
font-weight fontWeight Sets font weight. normal, bold, bolder, lighter, 100, 200, 300, 400, 500, 600, 700, 800, 900 All {font-weight: 600} Yes

Text Properties

Name JavaScript Name Description Possible Values Element Types Example inherited
letter-spacing Sets the space between characters. normal or length value All {letter-spacing: 0.2em} Yes
line-height lineHeight Sets the height of lines. normal, a number, a percent of the element font size, All {line- 本表原出处 http://www.comptechdoc.org/independent/web/cgi/javamanual/javastyle.html
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载