The conventions of a coding language that both signals the language and allows it to encode properly. Syntax may consist of both commands or
tags as well as punctuation.
Tag:
An encoding element in a markup language. Tags indicate the structure or format for content on the page.
Examples: HTML Syntax
<p>This is a paragraph that will show up on the page.</p>
This example shows the paragraph tag and a line of text.
<head>
<title>This is the title that shows up in the browser tab</title>
</head>
This example shows the head of an HTML page and the line of code that creates the title in the browser tab
Examples: CSS Syntax
h2 {color:#4d4d4d;}
In this example, you see the HTML tag that is being styled in purple. The attribute, in this case, font color
is in green, and the value it is being set to (in this case, a shade of gray) is noted with the hexadecimal value in
brown. For more information about color in web coding, see Module 2: Tutorial 5.
a:hover {color:#9d71a4;}
In this example, you see a CSS selector--the "hover." Selectors are signaled by colons as shown.
.video {
width:90%; margin-left:auto; margin-right:auto;
}
This example shows a custom class, designated with the "." in front of the class name. You can see that multiple attributes are
being defined in this case. The result of this code would be a centered block of content that covers 90% of the available space.