Markup for type
Inline elements and block elements
In normal body copy, text typically flows from one line to the next as we reach the edge of the visible page. We add words to a line, progressing horizontally from left to right, until we reach the end of the line and drop down to continue on the next line. In HTML, this is the default behavior for text without any markup. Many html elements are intended to flow with text in this way without interruption. Elements that have this behavior are known as inline elements. Common inline elements include a, strong, em, b, i, sup, sub, ,code
and span.
HTML also has elements which do not follow the normal flow of text, but instead define the containers, or blocks, within which inline text flows. Most html documents are fairly complicated hierarchies of 'nested' elements - blocks containing blocks, etc.
Common block elements include:
p, h1, h2, h3, h4, h5, h6, article, section, nav, aside, header, footer, and div.
Code comments
Sometimes, you want to put notes or comments into the code itself that are not visible to the end-user. These code comments can also be useful for temporarily 'removing' code from the page without actually deleting it, because code within a comment does not get parsed by the browser.Meta charset
There are many different technical standards for how text data can be encoded. It's a good idea to tell the browser how the text in your document is encoded, so it can be interpreted correctly. The UTF-8 standard is widely-used, and encompasses a huge array of glyphs for a multitude of languages.
HTML entities
There are some characters that must be handled differently because they are used to create the markup itself. These characters must be 'escaped' in your code with short 'words' called HTML Entities. These 'words' all begin with an ampersand, and end with a semi-colon. Angle brackets (less-than and greater-than) must be represented with html entities, since they are parsed to create tags themselves. Another common entity is the ampersand itself, since all entities begin with one. You'll find there are actually entities for virtually every glyph, but as long as you're using UTF-8, you won't need most of them.