HTML Synthax

The sequence of our words and the punctuation we employ in English matters. This is also true in coding!

Syntax is the set of rules that make it easier for us to understand each other when we speak or write. These rules usually include word order and punctuation.

Syntax for HTML elements is kind of like making a sandwich. Order is important! You don't want lettuce outside the bread.

Usually, each new element starts on its own line. There are a few exceptions. We'll learn more about those during the guided practice.

All HTML must be inside an <html> tag.

All content on the page is inside the <body> tag.

OPENING AND CLOSING ELEMENTS & TAGS

HTML tags are created with angle brackets. We wrap the tag name in these angle brackets. This slide shows an opening tag and closing for the paragraph “p”element . When you open a tag, you also need to close it.

SYNTAX HELPS WRITE CLEAN CODE

Usually, each new element starts on its own line. There are a few exceptions. We'll learn more about those during the guided practice.

All HTML must be inside an <html> tag.

All content on the page is inside the <body> tag.

CLEAN CODE MAKES YOUR JOB EASIER

Bugs happen! Having clean code will make it easier for you, or your colleagues, to find errors. Here are some tips to keeping your code clean: