Sample Video Frame

Created by Zed A. Shaw Updated 2024-07-21 04:57:00

09: Custom Tags

In this lesson you'll learn that you can use almost any name for an HTML tag, and use it to describe your document. Normally people stick to only approved tags for their documents, using <div> for almost everything. This works, but it tends to make the HTML far more complicated than it needs to be, and also tightly couples your CSS to your HTML document structure. When you use simpler custom tag names you're able to describe your document semantically, which makes it easier to manage.


Create a new .html file with the usual HTML5 template and then put this in it:

<name>Zed A. Shaw</name>
<last-login>2022-03-04 12:00:00</last-login>

If you reload it you'll see it doesn't look like much, but it is actually working. Now, add this to your <head> section:

body * {
  border: 1px solid red;

When you refresh now you should see red borders around all of the tags you just created. If you want to "disable" this then put a comment around the CSS:

body * {
 /*  border: 1px solid red; */
Previous Lesson Next Lesson

Register for Learn JavaScript the Hard Way

Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.