Important CSS Properties
For client-side JavaScript programmers, the most important features of CSS are the properties that specify the visibility, size, and precise position of individual elements of a document. Other CSS properties allow you to specify stacking order, transparency, clipping region, margins, padding, borders, and colors. In order to script CSS, it is important to understand how these style properties work. They are summarized in Table 16-1 and documented in more detail in the sections that follow.
Table 16-1. Important CSS style properties
Property | Description |
---|---|
position | Specifies the type of positioning applied to an element |
top , left | Specify the position of the top and left edges of an element |
bottom , right | Specify the position of the bottom and right edges of an element |
width , height | Specify the size of an element |
z-index | Specifies the “stacking order” of an element relative to any overlapping elements; defines a third dimension of element positioning |
display | Specifies how and whether an element is displayed |
visibility | Specifies whether an element is visible |
clip | Defines a “clipping region” for an element; only portions of the element within this region are displayed |
overflow | Specifies what to do if an element is bigger than the space allotted for it |
margin , border , padding | Specify spacing and borders for an element. |
background | Specifies the background color or image of an element. |
opacity | Specifies how opaque (or translucent) an element is. This is a CSS3 property, supported by some browsers. ... |
Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.