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.
HTML is the code that allows us to build websites
If you 'view the source', you see this
How your computer accesses websites
Photo credit: Eric Lease Morgan
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.
Photo credit: Cristiano Corsini cc
By the end of the class, you will have built a simple site using HTML and CSS on a topic of your choice. Here is one about rock climbing.
Your Content
+ HTML: Structure
+ CSS: Presentation
= Your Website
A website is a way to present your content to the world, using HTML and CSS to present that content & make it look good.
Concrete example:
<p>A paragraph is your content</p>
A paragraph is your content
<tagname>Stuff in the middle</tagname>
<p>This is a sample paragraph.</p>
<br />
<img />
<div id="copyright">©Girl Develop It logo 2016</div>
<img src="my_picture.jpg" />
<a href="http://girldevelopit.com">Girl Develop It</a>
The first thing on an HTML page is the doctype, which tells the browser which version of the markup language the page is using.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
4.01 Transitional//EN" "http://
www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE html>
* The doctype is case-insensitive.
DOCtype, doctype, DocType and DoCtYpe are all valid.
After <doctype>, the page content must be contained between <html> tags.
<!DOCTYPE html>
<html>
</html>
Head: The head contains the title of the page & meta
information about the page. Meta information is not visible to the user, but has many purposes, like providing information to search engines.
Body: The body contains the actual content of the page. Everything that is contained in the body is visible to the user.
<!DOCTYPE html>
<html>
<head>
<title>Title of the page </title>
</head>
<body>
The page content here.
</body>
</html>
Let's get our web page set up with a doctype, head, title and body.
Later we'll add some content.
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> inside of the <body> tags. The <p> is now nested inside the <body>
Whichever element OPENS first CLOSES last
Elements are 'nested' inside the <body> tag.
<body>
<p>A paragraph inside the body tag</p>
</body>
Paragraphs 'nested' inside list items.
<ul>
<li>
<p>A paragraph inside a list item</p>
</li>
</ul>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
<p>Paragraph 1</p> <p>Paragraph 2</p> <p>Paragraph 3</p>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
Paragraph 1
Paragraph 2
Paragraph 3
* White space is only for humans. You can write your code with any spacing.
Paragraphs allow you to format your content in a readable fashion.
* You can edit how paragraphs are displayed with CSS
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
* Heading number indicates hierarchy, not size. Think of outlines from high school papers
<p>
Here is a paragraph with <em>emphasized</em> text and <strong>important</strong> text.
</p>
Here is a paragraph with Emphasized text and Important text.
* Notice: em and strong are meant to indicate meaning through style. If you want to have italicized for appearance and not to communicate meaning, you should use CSS.
Let's add some content to our site!
Add one of each level of heading with 1-2 short paragraphs of text below each heading.
Use <strong> and <em> within a few paragraphs.
Links have three components
<a href="http://www.girldevelopit.com" title="Girl Develop It">Girl Develop It</a>
The <a> tag surrounds text or images to turn them into links
Links can have attributes that tell the link to do different actions like open in a new tab, or launch your e-mail program.
<a href="home.html" target="_blank">Link Text</a>
Link opens in a new window/tab with target="_blank"
<a href="mailto:sponsorships@girldevelopit.com">E-mail us!</a>
Adding mailto: directly before the email address means the link will open in the default email program.
"filename.jpg"
"img/filename.jpg"
https://www.girldevelopit.com/chapters/san-francisco
Images have three components
<img src="https://assets.brandfolder.com/4btx26fz/original/circle-gdi-logo.png"
alt="Girl Develop It logo"/>
* Notice: This tag is our first example of a stand-alone or "self-closing" element.
<p>
Imagine there's no Heaven<br/>
It's easy if you try<br/>
No hell below us<br/>
Above us only sky
</p>
Imagine there's no Heaven
It's easy if you try
No hell below us
Above us only sky
* Note: It's not good convention to put line breaks inside paragraphs. These lines are grouped together as a block of song verse, but we'll soon learn about better container tags to use...
Let's add links, images, and line breaks to our site!
<ul>
<li>List Item</li>
<li>Another List Item</li>
</ul>
<ol>
<li>List Item</li>
<li>Another List Item</li>
</ol>
Unordered list (bullets)
Ordered list (sequence)
Lists can be used to organize any list of items.
You'd be surprised how often lists are used in web design.
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!
You can add comments to your code that will not be seen by the browser, but only visible when viewing the code.
<!-- 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 are a way to represent complex information in a grid format.
Tables are made up of rows and columns.
<table>
<tr>
<th>Head</th>
<th>Head</th>
</tr>
<tr>
<td>Data</td>
<td>Data</td>
</tr>
</table>
Head | Head |
---|---|
Data | Data |
Tables can be styled with CSS to add zebra striping or to highlight important rows/columns.
There are character codes for many different characters in many different languages
δ
δ©
©`
`à
àSo far, we have mostly seen "block" elements. They appear on the next line, like paragraphs.
There are also "inline" elements. They appear on the same line that they are written on.
img, a, br, em, strong
p, h1, ul, li,
almost everything elsediv
s to control their styles with CSS.<div>
<p>Content<p>
<p>Content<p>
</div>
<div>
<h1>Main Heading<h1>
</div>
<div>
<p>Some more content<p>
</div>
div
tag is used everywhere to group elements together into sections.<div style="color: purple;">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>
<p>Sed do eiusmod tempor incididunt ut labore et dolore.</p>
</div>
<p>Magna aliqua. Ut enim ad minim veniam.</p>
<p>Quis nostrud exercitation ullamco.</p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit
Sed do eiusmod tempor incididunt ut labore et dolore.
Magna aliqua. Ut enim ad minim veniam.
Quis nostrud exercitation ullamco.
HTML5 offers new elements for better document structure and semantics
Some of the most commonly used new tags include:
<header></header>
<nav></nav>
<article></article>
<section></section>
<main></main>
<footer></footer>
A full list can be found here.
Let's create a site using divs to separate content into different sections on our page.
Create a header, content area, sidebar, and a footer.
A page divided into div
s might look like this:
<!doctype html>
<html>
<head>
<title>Sample Page</title>
</head>
<body>
<div id="header">
<h1>My Page Title</h1>
</div>
<div id="content">
<p>The main content</p>
</div>
<div id="sidebar">
<p>Some stuff in a sidebar</p>
</div>
<div id="footer">
<p>Copyright me</p>
</div>
</body>
</html>
A page divided using HTML 5 elements might look like this:
<!doctype html>
<html>
<head>
<title>Sample Page</title>
</head>
<body>
<header>
<h1>My Page Title</h1>
</header>
<main>
<p>The main content</p>
</main>
<aside>
<p>Some stuff in a sidebar</p>
</aside>
<footer>
<p>Copyright me</p>
</footer>
</body>
</html>
span
is used to apply a specific style inline
<p>Paragraph with <span style="color:teal;">teal</span> text.</p>
Paragraph with teal text.
Let's add some spans to our content to help highlight some text.