HTML, HyperText Markup Language, is a markup language used to create web pages. It essentially a language to describe the structure and content of a document.
Note: HTML is separate from CSS. CSS is a presentation language used to describe the style/appearance of the content. What font type or sizes, colors, spacing between text, etc.
Elements are used to define the structure and content of the document. These includes things like <h1>
, <h2>
, <h3>
... <h6>
(headings), <p>
(paragraphs), <a>
(links), etc.
Elements are represented by the element name wrapped in angle brackets: < >
.
To mark the beginning and end of an element we use tags. Tags usually come in an open and close pair.
- Opening tag:
<span>
- Closing tag:
</span>
notice the forward slash - So then:
<span>content of the tag</span>
Attributes are properties that can be supplied to provide additional information about an element. Some common attributes are id
, href
, and class
.
- Attributes are specified within the opening tag
- Attributes usually have a name and value
- They are written like
name="value"
For example, if you wanted to provide a clickable link to a website, you could use the a
tag along with the href
attribute like this:
<a href="https://perts.net">Visit PERTS</a>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>HTML Workshop</title>
</head>
<body>
</body>
</html>
When you place on element within another elements, it's called nesting.
For readability / organization, it's a good idea to indent nested elements.
Some elements don't need a closing tag. Examples are:
<meta>
(which you see in the "Starting Document" above),<br>
,<img>
,- and
<hr>
.
HTML 5.2
https://www.w3.org/TR/html52
PERTS Logo: https://perts.net/static/images/pertslogo.png
Screenshot: https://www.evernote.com/l/AJ41BuPTEKVDLas0xi09fiDn46RkyJpGVVoB/image.png