Click to skip over navigation
 

lecture 2: block-level v. inline tags

<< previous slide

return to lesson 2 index

next slide >>


Text formatting tags can broadly be divided into two categories - although in some ways there are three. These are:

  • block-level tags. The most common are <p> tags and the six heading tags. They define "blocks" of text, invariably with blank lines separating the words from other blocks. Remember that you cannot use line breaks and spaces within the actual HTML code to separate blocks of text: see the page on how text is handled for more details.
  • inline tags. Inline tags do not cause the lines of text to break. Examples are the <b> (bold) and <i> (italic) tags. Link, or <a> tags, are also inline.
  • list tags - which produce bulleted or numbered lists like the ones you're reading now - are nearly block-level tags but differ slightly in that they don't put blank lines between elements and can be nested within each other, so they're almost a third family.

For more details on the specific use of text formatting tags you should read the online teaching materials once the lecture is over.

Remembering which tag belongs to which family is a good idea because you need to know about how these tags can be nested. In general:

  • inline tags can be nested inside each other, and within block-level tags. In fact, you should not use an inline tag or tags without nesting it/them inside a block-level tag.
  • block-level tags cannot be nested inside each other, nor within inline tags

In effect, then, block-level tags are at a higher level of the "hierarchy" of tags than inline tags. Inline tags will usually inherit properties from the block-level tags they're nested within. Block-level tags only usually inherit properties from the <body> tag.




<< previous slide

return to lesson 2 index

next slide >>