Friday, February 12, 2010

JavaScript Style Attributes

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 {height: 200} No
margin Set element margin width. A single value sets all margins, two values set top and bottom, four values set top, right, bottom, and left margins. auto, length value, or percent value All {margin: 4em 2em 4em 2em} No
margin-bottom marginBottom Set element bottom margin length value, or percent value All {margin-bottom: 4em} No
margin-left marginLeft Set element left margin length value, or percent value All {margin-left: 4em} No
margin-right marginRight Set element right margin length value, or percent value All {margin-right: 4em} No
margin-top marginTop Set element top margin length value, or percent value All {margin-top: 4em} No
padding Space between border and content. A single value sets all sides, two values set top/bottom and left/right, three values set top, right/left, and bottom, and four values set top, right, bottom, and left. length value, or percent value All {padding: 4em} No
padding-bottom Space between bottom border and content. length value, or percent value All {padding-bottom: 4em} No
padding-left Space between left border and content. length value, or percent value All {padding-left: 4em} No
padding-right Space between right border and content. length value, or percent value All {padding-right: 4em} No
padding-top Space between top border and content. length value, or percent value All {padding-top: 4em} No
width Width of element auto or a height value in length or percentage Block elements and IMG, INPUT, TEXTAREA, SELECT, and OBJECT {width: 40em} No


No comments :