The web is very open and loose, but there are "official" rules.
The Doctype tag tells the web browser what version of HTML is contained in your page.
<!doctype html>
Your HTML tag immediately follows the Doctype tag. Every page must have one and all content goes in between the tags. Google guides recommend omitting these, but maybe buggy in old versions of IE.
<!doctype html>
<html>
</html>
The Head tag contains information used by the browser or search information
The Body tag contains everything visible to the user
***Once again, Google guides recommend omitting these.
<!doctype html>
<html>
<head>
<title>Page Title</title>
</head
<body>
Page Content
</body>
</html>
Elements inside the body tag are nested. The newest element must be closed before it's parent. Similar to nesting dolls.
Paragraph tags are used for general blocks of text.
<p>This is my first paragraph</p>
<p>This is my second paragraph</p>
This is my first paragraph
This is my second paragraph
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin commodo velit erat, quis sodales ligula commodo a. Praesent id massa maximus, rhoncus tellus varius, posuere lectus.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin commodo velit erat, quis sodales ligula commodo a. Praesent id massa maximus, rhoncus tellus varius, posuere lectus.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin commodo velit erat, quis sodales ligula commodo a. Praesent id massa maximus, rhoncus tellus varius, posuere lectus.
The heading tag is used to label important blocks of content.
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
There are tags available for adding emphasis and important
<p>
There are tags available
for adding <em>emphasis</em>
and <strong>important</strong>
</p>
There were tags dedicated to italics, bold and underline
<p>
There were tags dedicated to
<i>italics</i>,
<b>bold</b>
and <u>underline</u>
</p>
These tags are deprecated and you should use CSS to replace these
Special characters such as ©, >, ¶, and —
Come after the initial tag declaration.
Typically a name value pair.
Changes how elements look or act.
Some tags have unique attributes.
Hyperlinks are primarily used to link to different webpages.
The tag wraps text or images and allows them to be clicked
We can use the hyperlink tag for a couple more things.
<a href="mailto:Jonathan.Middaugh@jbhunt.com">Email me!</a>
<a href="steam://run/400">Play Portal!</a>
Used to inject an image into the page
There are two types of list. Ordered List and Unordered lists. They both contain list item tags.
Commonly just a bulleted list.
- Item 1
- Item 2
- Item 3
- Nested 1
- Nested 1
- Item 4
Similar to the unordered list, but uses numbers instead of bullets
- Item 1
- Item 2
- Item 3
- Nested 1
- Nested 1
- Item 4
Tables are use to display tabular data in a grid formation. Tables are frequently misused.
See the Pen UA-HTML-Tables by Jon (@Middaugh) on CodePen.
Html Comments are used to add information to code. Comments can be important when other people are looking at your code.
<!-- Start Header -->
<div class="header">
</div>
<!-- End Header -->
The div tag is used to represent a division or a section of HTML code. A div is primarily used with CSS to adjust the layout of your web page.
Block level elements always start a new line and span the full width of available space
<div>
<div>This is my first div</div>
<div>
This is my second div
<p>
Paragraphs are block elements too.
</p>
</div>
</div>
Paragraphs are block elements too.
The span tag has no visual change when used. The span tag can be used to apply styles to a specific block of text.
Inline elements do not start a new line.
<p>
<span>These</span>
<strong>are </strong>
<span>all</span>
<em>in different inline</em>
<span>elements</span>
</p>
These are all in different inline elements
The Class attribute is used to reference a class in a Style Sheet. You can also target an element by in JavaScript by its class.
Title 1
Desc 1
Title 2
Desc 2
Use the ID attribute to be able to specifically target an element. IDs must be unique. You will get inconsistent results if there are multiple elements with the same ID.
<div id="site-header">
<h1 id="myTitle">My Title</h1>
</div>