Saturday, May 31, 2008

Learned some new things about text formatting with HTML

  • font size: in CSS definitions, best practice is to define the base font size in px, in the body styles definition, then the remaining sizes in ems. So the base size is set to an absolute size and the other styles will be a percentage of that. This follows from the inheritance rule that the child styles will inherit the parent font size as an absolute, then modify it by a defined percentage.
  • HTML syntax: <tag attribute="value">
  • W3C defined font families, 5 of them: Serif, Sans-serif, Monospace, Fantasy (Curlz, Jokerman), Cursive (Zapf-Chancery, Lucida Handwriting)
  • blockquote tag: The text indent button in DW actually adds a blockquote tag around the selected block (p or div) of text
  • physical versus logical styles: HTML text styles come in two philosophically distinct categories. Physical styles define the appearance, such as <b> or <i>. Logical styles set the appearance of a type of information, such as <code> or a <cite> (for a citation), or, yes, <em> and <strong> (see below). Logical styles aren't defined in the code, however, but by the browser, so if you want control over those definitions you must define them in your CSS. There are some logical tags I'd never heard of, like Variable, <var>, Sample, <samp>, Keyboard, <kbd>, Definition, <dfn>, Deleted, <del>, and Inserted, <ins>.
  • bold and italic: <b> and <i> tags are physical, whereas <strong> and <em> are logical tags. It is considered "better practice" to use the logical tags rather than the physical.

No comments :