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

PropertyDescription
positionSpecifies the type of positioning applied to an element
top, leftSpecify the position of the top and left edges of an element
bottom, rightSpecify the position of the bottom and right edges of an element
width, heightSpecify the size of an element
z-indexSpecifies the “stacking order” of an element relative to any overlapping elements; defines a third dimension of element positioning
displaySpecifies how and whether an element is displayed
visibilitySpecifies whether an element is visible
clipDefines a “clipping region” for an element; only portions of the element within this region are displayed
overflowSpecifies what to do if an element is bigger than the space allotted for it
margin, border, paddingSpecify spacing and borders for an element.
backgroundSpecifies the background color or image of an element.
opacitySpecifies 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.