Archive results for:

What is Semantics?

Semantics in front-end development concerns whether to use a div or a header, or if some text should be a paragraph or a heading, or whether a list is to be ordered or unordered, and so on. It’s about elements and not attributes.

It’s about machines (screen readers, browsers, assistive technologies, bots) gleaning meaning from the elements we use to mark up our documents. Read more ›


Naming your ID and Classes

When naming your IDs and classes, it is important that you keep the names as “unpresentational” as possible.

For instance, if you want all of your form notification messages to be red, you could give them a class of red. This is fine as long as there are no other red elements on the page. However, say you wanted to style required form labels red as well. You are now forced to guess to which element that class could refer, and things are already starting to get confusing.

Imagine how confusing the code could become if you used presentational elements across the whole site? Read more ›


Most Common HTML DOCTYPES

The DOCTYPE isn’t exactly an HTML tag or XHTML element. Instead it is a declaration and always appears at the very top of your documents. It identifies the version of the markup  language the page was created.

It refers to a known Document Type Definition, or DTD for short. The DTD sets out the rules and grammar for that version of markup, enabling the browser to render the content as well as allow a validator which version of HTML to use in checking the document’s syntax.

Below are the most common DOCTYPES, although HTML5 should be the one you use from now on. Read more ›