-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
235 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import {CodeHighlighter} from 'components/atoms'; | ||
|
||
const styles = { | ||
wrapper: {display: 'flex', flexFlow: 'row wrap'}, | ||
tab: {display: 'flex', flexFlow: 'column nowrap', margin: 16}, | ||
label: { | ||
border: '1px solid black', | ||
borderTopRadius: 2, | ||
borderBottom: 'none', | ||
padding: 4, | ||
margin: 4, | ||
}, | ||
}; | ||
|
||
const HtmlDemo = ({srcString}) => { | ||
console.log(srcString); | ||
return ( | ||
<div style={styles.wrapper}> | ||
<div style={styles.tab}> | ||
<div style={styles.label}>Code</div> | ||
<CodeHighlighter>{srcString}</CodeHighlighter> | ||
</div> | ||
<div style={styles.tab}> | ||
<div style={styles.label}>Result</div> | ||
<iframe srcDoc={srcString}></iframe> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default HtmlDemo; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
--- | ||
title: 'Intro' | ||
slug: 'intro' | ||
contentType: 'TextContent' | ||
--- | ||
|
||
import HtmlDemo from './HtmlDemo'; | ||
|
||
# What is HTML? | ||
|
||
In the course intro, we learned that: | ||
|
||
- **HTML** is for the structure and content of web pages. | ||
- **CSS** is for styling the page. | ||
- **JavaScript** is for controlling interactions. | ||
|
||
HTML is a syntax for the structure and content of pages. It's made of letters and symbols that | ||
follow some rules. | ||
|
||
Let's see the example of what you'll build, then dig into the syntax. | ||
|
||
## An HTML Recipe Site | ||
|
||
Here's a preview of the type of site you'll build first. | ||
|
||
<Exercise title="Recipe Page Demo" contentSrc="@makeschool2/Recipe-Page-Demo" outputOnly={true} /> | ||
|
||
It doesn't look incredible, but it gets the job done. When we learn CSS, we can improve how it | ||
looks. By the end of this topic, you'll be able to write code for this kind of site from scratch. | ||
|
||
## HTML Tags | ||
|
||
<HtmlDemo srcString="<p>This tender treat is a perfect use for any old bananas you have sitting on the counter.</p>" /> | ||
|
||
The HTML turns into a paragraph of text. This an HTML **element**: a single building block of a | ||
webpage. Let's break down the parts of the syntax. | ||
|
||
`<p>` is an HTML **tag**. It starts an element, and says what kind of element it is - in this case, | ||
`p` is for a _paragraph_ element. | ||
|
||
`</p>` is a **closing tag**. It says "the paragraph ends here". Notice that it has a forward slash | ||
`/`. Everything between the opening tag and closing tag are inside of the element. | ||
|
||
Each **opening tag** needs to have a matching closing tag. Every `<p>` needs a `</p>`. | ||
|
||
In between the opening and closing tags is some text: | ||
`This tender treat is a perfect use for any old bananas you have sitting on the counter.` It's what | ||
actually shows up on the page. | ||
|
||
Let's learn about these elements. | ||
|
||
`h1` is a _heading level one_ tag. It means the has the effect of making the text big. `h1` is the | ||
biggest size heading, usually used for the title of the page. There's 6 levels of heading, with 6 | ||
tags, representing a smaller heading as the number goes up: `h1`, `h2`, `h3`, `h4`, `h5`, `h6`. | ||
|
||
`ul` stands for _unordered list_. It makes a list. The list items inside each get a dot next to | ||
them. | ||
|
||
`li` is a _list item_. These are the elements in the list. Since they're between the opening and | ||
closing tags the `ul` element, they appear inside the same list. | ||
|
||
`img` is an _image_. It has a new syntax too: an attribute `src` for the source of the image. That | ||
`src` is the location where the browser can find the image itself. | ||
|
||
## More HTML Elements | ||
|
||
Here's another demo, with four new html elements. | ||
|
||
<HtmlDemo | ||
srcString=' | ||
<h1>Easy Chocolate Chip Banana Bread</h1> | ||
<ul> | ||
<li>10 minutes prep time</li> | ||
<li>50 minutes bake time</li> | ||
<li>1 hr total</li> | ||
<li>Makes 6 servings</li> | ||
</ul> | ||
<img src="./banana-bread.jpeg" />' | ||
/> | ||
|
||
<TextResponse> | ||
<Prompt> | ||
|
||
What are the four new HTML elements you see in this example? | ||
|
||
</Prompt> | ||
|
||
<Explanation> | ||
|
||
The four elements are: | ||
|
||
- `h1` | ||
- `ul` | ||
- `li` | ||
- `img` | ||
|
||
</Explanation> | ||
</TextResponse> | ||
|
||
## Nesting Elements | ||
|
||
## Summarizing the rules of HTML | ||
|
||
## Vocab | ||
|
||
Here's the names of the different parts of syntax. | ||
|
||
Vocab: | ||
|
||
- Tag | ||
- Element | ||
- Opening and closing tag | ||
- Angle bracket | ||
- Attribute | ||
- Parent element | ||
- Child element | ||
- Nesting | ||
|
||
## The most common elements | ||
|
||
- Most common elements | ||
- Most common is ... just text! | ||
- h1-h6 | ||
- p | ||
- ul, ol, li | ||
- img | ||
|
||
## Common Errors | ||
|
||
When you're first learning the syntax, there's a bunch of common errors. | ||
|
||
- typo for the name of an element | ||
- forgetting or using the wrong symbol in the wrong spot (typos for the HTML syntax) | ||
- forgetting quotes around attributes | ||
- wrong direction of the slash for a closing tag | ||
- forgetting a closing tag | ||
- improper nesting of tags (crossing the tags) | ||
|
||
(Fix the error game) | ||
|
||
### Tips and Strategies | ||
|
||
Formatting is your friend. The browser ignores whitespace like spaces, tabs, and newlines. It also | ||
ignores comments. | ||
|
||
It's _much_ easier to spot mistakes if your HTML is formatted nicely. "Nicely" means that (for the | ||
most part) each new tag goes on a new line, indented further than its parent element. The closing | ||
tag is dedented, so the nested structure is visible. | ||
|
||
Comments are also super helpful. They have a funky syntax, so it's easy to mess them up too. | ||
|
||
- Highlight and use [ctrl /] to comment out a section | ||
- Use comments to name sections of your page | ||
|
||
Debugging HTML using comments. | ||
|
||
- comment out the code you think is broken | ||
- comment it back in, piece by piece, to identify what's broken | ||
|
||
## Developer Tool: Browser Inspector | ||
|
||
Desktop browsers have a tool called the inspector or dev console that lets you see the code for a | ||
page. | ||
|
||
### Try it now | ||
|
||
- Somewhere on the page, secondary click (right click, two-finger click, or hold control and click) | ||
to open the context menu | ||
- Click to open the inspector: "Inspect" in Chrome, or "Inspect Element" in Firefox or Safari. | ||
- See that the Inspector opens in a tray at the bottom or side of your screen: | ||
|
||
- The panel shows the HTML for all of the elements on the page | ||
- The highlighted element is the one that you clicked on | ||
- As you hover over other elements in the panel, you can see that the browser highlights the | ||
corresponding elements on the page | ||
|
||
## Project: Recipe Page | ||
|
||
- Change the recipe site to use the correct elements | ||
- Turn this recipe blob into a website that looks like (this) |
4 changes: 2 additions & 2 deletions
4
T007-Forms--Inputs--and-Events/_index.mdx → T007-Forms-Inputs-and-Events/_index.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: 'Forms, Inputs, and Events' | ||
slug: 'forms--inputs--and-events' | ||
slug: 'forms-inputs-and-events' | ||
contentType: 'CourseTopic' | ||
--- | ||
--- |
4 changes: 2 additions & 2 deletions
4
...-Loops--Objects--and-Functions/_index.mdx → ...JS-Loops-Objects-and-Functions/_index.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: 'JS Loops, Objects, and Functions' | ||
slug: 'js-loops--objects--and-functions' | ||
slug: 'js-loops-objects-and-functions' | ||
contentType: 'CourseTopic' | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
title: 'Web 1.0: Web Foundations' | ||
slug: 'web-foundations' | ||
contentType: 'CourseSyllabus' | ||
--- |