CSS Tips
<DIV> VERSUS <SPAN>. While neither by itself changes the appearance of an item, <DIV> does create a paragraph break whereas <SPAN> does not. Thus you cannot apply <DIV> to one or two words within a line; you can <SPAN>. In the parlance of HTML, <DIV> is a block-level element while <SPAN> is inline.
<CLASS> VERSUS <ID>. The difference is that <id> is for items that appear only once on a page, such as headers and footers. <Class> is for elements that can appear many times, for example photo captions. The definition of an <id> must begin with the "#" character (e.g., "#footer"); that of a <class> with a "." (e.g., ".caption"). Another difference is that a class can be limited to a particular HTML tag. Thus, a style defined as "p.caption {specs}" will have no effect if assigned to any element other than <p>. Finally, if an <id> and a <class> are applied to the same page element, the <id> should take precedence to the extent its properties differ from those of the <class>.
|