Class 1
Girl Develop It is here to provide affordable and accessible programs to learn software through mentorship and hands-on instruction.
Some "rules"
Tell us about yourself.
Thank you to our wonderful TAs!
We'll be using the following tools in class today:
A markup language is a set of markup tags:
<tagname>content</tagname>
Each HTML tag describes its content:
<p>This sentence goes in a paragraph (p) tag.</p>
If you 'View Page Source', you see this:
Your Content
+ HTML: Structure
+ CSS: Presentation
= Your Website
A website is a way to present your content to the world, using HTML to structure that content, and CSS to make it look good.
A paragraph is your content
<p>A paragraph is your content</p>
A paragraph is your content
<section>Content in the middle</section>
<p>The p tag means this content is a paragraph.</p>
<header>The header tag means this content is a website's header.</header>
Whenever you type an opening tag, immediately type the closing tag, then fill in your content.
<strong>
<strong></strong>
<strong>Now I can add content!</strong>
Shorthand
<p>This is content within the opening and closing tags.</p>
<br />
<img src="images/photo.jpg" />
The examples are shorthand for <br></br> and <img src="images/photo.jpg"></img>
Attributes
Adding attributes to an HTML tag provides additional information about the HTML element
Attributes
<img src="my_picture.jpg" />
<div id="intro">Lorem ipsum</div>
<a href="http://girldevelopit.com" class="fancy-link">GDI</a>
Doctype
The first thing in an HTML file is the doctype, which tells the browser which language the page is using:
<!DOCTYPE html>
The doctype is case-insensitive.
DOCtype, doctype, DocType and DoCtYpe are all valid.
HTML Element
After <!DOCTYPE html>, the page content must be contained between <html></html> tags.
<!DOCTYPE html>
<html>
</html>
Head Element
The head contains information about the page, but does not contain page content. It contains elements that let the browser know:
<!DOCTYPE html>
<html>
<head>
</head>
</html>
Body Element
The body contains the actual content of the page. Everything that is contained in the body is visible to the user.
Most of your work will be done within the <body></body> tags!
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
</html>
Memorize this ☺
<!DOCTYPE html>
<html>
<head>
<title>Title of the page</title>
</head>
<body>
All of your page content goes here
</body>
</html>
All the files for your site should be stored within the same folder.
This includes:
Note: File names should not include spaces or special characters. File names ARE case sensitive.
Go ahead and create your folders
Ignore the HTML and CSS files for now
Later we'll add some content to it!
All elements "nest" inside one another
Nesting is what happens when you put other containing tags inside other containing tags. For example, you would put the <p></p> inside of the <body></body> tags. The <p></p> is now nested inside the <body></body>, and is one of its descendants
All your page's content is 'nested' inside the body element:
<body>
<p>
A paragraph inside the body element
</p>
</body>
And other elements can be nested inside of that:
<body>
<p>
A paragraph inside the body element
<em>which has some italic text</em>
and
<strong>some bold text</strong>
</p>
</body>
⇒ A paragraph inside the body element which has some italic text and some bold text
HTML elements are often looked at as a family tree. Developers will often refer to elements as "siblings", "immediate children", and "descendants".
Can you name any siblings?
<!DOCTYPE html>
<html>
<head>
<title>Title of the page</title>
</head>
<body>
All of your page content goes here
</body>
</html>
How about immediate children?
<ul>
</ul>
<ul>
<li>I'm indented!</li>
<li>I'm also indented!</li>
</ul>
This will make your life much easier down the road, as you add more content and style your pages.
HTML ignores multiple whitespaces in a row. You can add consecutive white space characters (spaces, tabs, & carriage returns) into your HTML, but when you view that page — all but one disappears!
HTML:
<p>Two carriage returns
Three carriage returns
Plus multiple spaces ...</p>
Result:
Two carriage returns Three carriage returns Plus multiple spaces ...
To force consecutive spaces to show, use (stands for "no-break space") in your HTML instead of spaces.
Paragraph
HTML:
<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
Result:
Paragraph 1
Paragraph 2
Paragraph 3
Paragraphs in Action
Paragraphs allow you to format your content in a readable fashion.
You can edit how paragraphs are displayed with CSS
Headings
HTML:
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
Result:
Headings in Action
Formatted text
HTML:
<p>Here is a paragraph with <em>Emphasized</em> text and <strong>Important</strong> text.</p>
Result:
Here is a paragraph with Emphasized text and Important text.
Let's add some content to our site!
Remember to place content in the body element, not the head
Links
Standard links have three components:
<a></a>
GDI Burlington
href="http://www.girldevelopit.com/chapters/burlington"
<a href="http://www.girldevelopit.com/chapters/burlington">GDI Burlington</a>
Additional Link Options
title="Read more about GDI Burlington"
target="_blank" (opens link in a new tab)
<a href="http://www.girldevelopit.com/chapters/burlington" title="Read more about GDI Burlington" target="_blank">GDI Burlington</a>
Additional Link Options
Additional Link Options
<a href="mailto:rachaela@girldevelopit.com">Email me!</a>
Let's add links to our site!
Add links that:
Images
Images have three components:
<img />
src="http://lorempixel.com/200/200/city/"
alt="Picture of a city"
<img src="http://lorempixel.com/200/200/city/" alt="Picture of a city" />
* Notice: This tag is our first example of a stand-alone or "self-closing" element.
Relative vs. absolute paths for links, images, etc.
"filename.jpg"
"images/filename.jpg"
"http://www.girldevelopit.com/chapters/burlington"
Line Break
<p>
You spin me right round, baby<br />
Right round like a record, baby<br />
Right round round round
</p>
You spin me right round, baby
Right round like a record, baby
Right round round round
Let's add some images and line breaks to our page. We can even turn some images into links!
Unordered and ordered lists
HTML:
<ul>
<li>Unordered List Item</li>
<li>Another List Item</li>
</ul>
<ol>
<li>Ordered List Item</li>
<li>Another List Item</li>
</ol>
Result:
Lists in Action
Lists can be used to organize any list of items.
You'd be surprised how often lists are used in web development.
Let's add one of each ordered and unordered lists to our page.
We can make a list of links or even a list of images!
Comments
You can add comments to your code that will not be seen by the browser, but only visible when viewing the page source.
<!-- Comment goes here -->
Comments can be used to organize your code into sections so you (or someone else) can easily understand your code. It can also be used to 'comment out' large chunks of code to hide it from the browser.
<!-- Beginning of header -->
<div id="header">
Header Content
</div>
<!-- End of header -->
<!--<ol>
<li>List Item</li>
<li>Another List Item</li>
</ol>-->
Tables
Tables are a way to represent complex information in a grid format. Tables are made up of rows (tr), which contain cells (th for table header cells, or td for standard table data cells).
HTML:
<table>
<tr>
<th>Head 1</th>
<th>Head 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
Result:
Head 1 | Head 2 |
---|---|
Data 1 | Data 2 |
Tables in Action
Character Codes
©
»
< and >
How to Style Sites — Introduction to CSS
If you haven't already, try to make one of each element discussed in the lecture today and save your HTML file. Next week we'll style it!