๐บ Content!
Coding Camp
๐ Introduction
Goals
- Create a webpage
- Make it well-formed
- Make it stylish
- Make it graphical
- Make it interactive
Today
๐ Standards
What?
- HTML5 is the latest, greatest, and final version of โHTMLโ
- Hypertext
- Text for the internet
- Markup
- Text that describes how it should be displayed
- Language
- A consistent grammar for the above
- Hypertext
How?
- HTML Living Standard
- Check it out!
-
- That is, doesnโt break any rules.
-
๐ Visually
Why?
- Thus far we relied on default behavior.
Hello, world
was assumed to be:- The content of
- A paragraph in
- The body of
- A website with
- No name or
- Special formatting
๐ Refresh
What?
- We recall last time we:
- Followed these instructionsโ
- Created a GitHub repository
github.com/<account>/<repository>
- Worked in GitHub Codespaces
- Clicked on <> Code ๐ฝ
- Created a corresponding GitHub page:
<account>.github.io/<repository>
How?
- I recommend having exactly these four websites open in tabs.
- Read these instructions
- Make changes in the Codespace
- Verify them in the repository
- After a few minutes, see them on the webpage
Why?
- It is a little to easy to give up and do nothing.
- That is no fun!
- Check that everything works, every time.
- Itโs good practice!
๐บ Content
What?
- The part of HTML we see is the content
- Usually text (like this)
- Sometimes images, like below:
An image of an image of an image
How?
- Letโs update
index.html
- Weโll specify that our text is a paragraph.
- We prefix with
<p>
and suffix with</p>
๐จ Alert!
- Codespaces will automatically โcloseโ
<p>
when you type them!- This is meant to help you, and will help in time!
- It is not uncommon to use line breaks:
โ ๏ธ Caution
- Usually nothing breaks if you omit the closing tag
</p>
- It is considered poor form because it can cause problems in more complicated cases.
Why?
- Until now, we had no way to tell HTML when to start a new line.
- This looked dreadful!
- Now we can!
๐ Bonus!
- You donโt only have to use
<p>
, of course! - The next most common are headings -
<h1>
is the biggest. - Try giving your webpage a heading perhaps saying itโs mine.
๐ช Nesting
What?
- We can include one kind of HTML content in another kind of HTML content.
- I term this โnestingโ
How?
- Weโll use a new element -
<a>
, for links. - Add link from your GitHub page to your GitHub repository.
- Choose some link text, like โMy Repositoryโ
- Enclose in
<a>
and</a>
- In the opening tag
<a>
, addhref=<the address of your repository>
- Mine would be
<a href="https://cd-example.github.io/bug-free-sniffle/">
๐ Visually
Why?
- This sort of nesting is a natural way to arrange information.
- Letters in words.
- Words in sentences.
- Sentences in paragraphs.
- Paragraphs in essays.
- Etc.
โ ๏ธ Caution
- We can nest but not overlap.
- Consider the example using bold and italics
- Try this:
This is very wrong!
- And this:
This is correct.
๐ช Bodies
What?
- Not every part of a webpage is content.
- To specify just the page content, we place it within a
<body>
.
๐ฅท An Aside
- Content is enclosed in โtagsโ, like
<p>
- Content and tag is called an element.
Thing | Term |
---|---|
Hello |
Content |
<p> |
Tag |
<p>Hello</p> |
Element |
- Most useful to look up how to do things.
- E.g. center text with the
<center>
tag.
- E.g. center text with the
How?
- Weโll use a new element -
<body>
- Weโll buy everything so far inside it.
- For me, this meant indenting everything again.
๐ Visually
Why?
- This doesnโt do anything yet.
- But will allow us to add headers:
- Ways to change how the page is understoodโฆ
๐คฏ Heads
What?
- Take a look at either the:
- Name of the window you are looking at, or
- Name of the tab you are looking at
- It is probably โCoding Camp - ๐ HTML!โ
- How did that get there?
How?
- We can specify:
- Page title
- Style using CSS (latter)
- Scripts using JS (latter)
- Add to the beginning of your page:
Why?
- Less important than it used to be, though still looks sharp.
- Historically important for search engines!
๐ HTML
What?
- In the very early days there were (maybe?) formats other than HTML.
- I donโt know what they would be!
- But there were at least other versions (namely 1-4)
- So HTML pages should specify they areโฆ HTML!
How?
- Enclose everything within an
<html>
element.- If in English, usually
<html lang="en">
- If in English, usually
- Add a file header for ducment type
- For HTML, this is
<!DOCTYPE html>
- For HTML, this is
Why?
- Makes things easier (and therefore faster) for web browsers.
- Mark of professionalism.
๐ค Altogether
What?
- We have now covered all the requirements to make a well-formed HTML page!
How?
Example:
Why?
- Per โindeed.comโ (maybe donโt just trust them).
- 100+ jobs
- Most around $40+/hr
- ๐ค
- Also its fun!
๐ Sync
What?
- Make sure you sync your Codespace to your repository.
- GitHub Pages will update automatically.
- Show off your work!
How?
- You can review from last time
Why?
- We learn by doing!
- A little bit every day!
๐ฌ Comments
What?
How?
<!--
and-->
Why?