HTML and CSS Reference
In-Depth Information
We assume that the JavaScript function favorite_font_size() somehow
determines the desired font size and returns a string value containing
that size. This, in turn, is assigned to the fontSize property for the <p>
tag, defining the font size for all paragraphs in the document. Defining styles for tags
JavaScript defines a document property called tags that contains the
style properties for all HTML tags. To define a style for a tag, simply
set the appropriate property of the desired style property within the tag
property of the document object. For example:
document.tags.P.fontSize = '12pt';
document.tags.H2.color = 'blue';
These two JSS definitions set the font size for the <p> tag to 12 points
and render all <h2> tags in blue. The equivalent CSS definitions are:
p {font-size : 12pt}
h2 {color : blue}
Because the tags property always refers to the current document, you
may omit document from any JSS tag style definition. We could have writ-
ten the preceding two styles as:
tags.P.fontSize = '12pt';
tags.H2.color = 'blue';
Search WWH ::

Custom Search