HTML and CSS Reference
HTML style Attribute
HTML content elements (those not associated with the document
<head> ) have a style attribute that can be used to assign a semicolon-
separated list of CSS declarations to that specific element.
<p style=”color: pink”>A Pink Paragraph</p>
This attribute is an unwieldy method of styling an entire document but
can occasionally be useful on a project where it is important for style
information to be matched with the HTML content such as when sharing
HTML content across sites or defining one-off special cases for styling an
object on an element or to read current styling information (used values)
via the getComputedStyle method.
document.styleSheets object, which is a useful technique for creating
bridge libraries to bring support for unsupported CSS properties or selec-
tors to older browsers (discussed in Chapter 13).
cased, rather than hyphenated. In other words, margin-left becomes
CSS does not rely on whitespace or indentation to parse the values, but
consistent use of whitespace can make code easier to follow—as can
thoughtful organization of the rules in a document and good use of CSS