2. What is HTML?
• Hypertext Markup Language
• Using HTML, text is formatted by wrapping it in a tag.
• The tags provide instructions to the browser (Safari, IE,
Firefox, Chrome, etc.) for how to render the text on screen.
<h2>Text wrapped in an heading level 2 tag looks like this</h2>
START TAG END TAG
4. 3 Parts of an HTML Document
• An HTML document is divided into three sections:
1) Declarations 2) Head 3) Body
1
2
3
5. Document Type
• The <!DOCTYPE> declaration must be the very first
thing in your HTML document, before the <html> tag.
• The <!DOCTYPE> declaration is not an HTML tag; it is
an instruction to the web browser about what version of
HTML the page is written in.
7. GETTING STARTED
• OPEN UP NOTEPAD ON YOUR COMPUTERS
• IF YOU’RE WORKING FROM A MAC DOWNLOAD
TEXTWRANGLER
• Start writing your code:
<html>
</html>
8. Inside <html> </html>
There are 2 sections within the <html></html>tags:
• <head> </head>
The head tag contains information about the page
• <body> </body>
Actual content displayed to the user on the web page
9. Type that out in Notepad
<html>
<head>
</head>
<body>
</body>
</html>
11. Now Save it
1. Save as html file in a folder titled “HTML”
(type “.html” at end of file name if necessary)
2. OPEN FILE in WEB BROWSER-drag file into a new tab
3. You will see the TITLE on the tab (nothing on pg. yet)
13. TEST THAT OUT!
<html>
<head>
<title>Title of my Page</title>
</head>
<body>
<h1>Hello World</h1>
<h2>My Name is Briana</h2>
<h3>I am your teacher</h3>
</body>
</html>
14. PARAGRAPH TAG
<p><p/>
<html>
<head>
<title>Title of my Page</title>
</head>
<body>
<h1>Hello World</h1>
<h2>My Name is Briana</h2>
<h3>I am your teacher</h3>
<p>This is my first year teaching these classes. All of my
students are wonderful and talented. They are all going to
understand basic coding by the end of this class.</p>
</body>
</html>
15. Add another paragraph
<html>
<head>
<title>Title of my Page</title>
</head>
<body>
<h1>Hello World</h1>
<h2>My Name is Briana</h2>
<h3>I am your teacher</h3>
<p>This is my first year teaching these classes. All of my
students are wonderful and talented. They are all going to understand
basic coding by the end of this class.</p>
<p>This is my second paragraph. As you can see, it is below
my first paragraph.</p>
</body>
</html>
16. Breaking up a Paragraph
• </br> - another self closing tag
<html>
<head>
<title>Title of my Page</title>
</head>
<body>
<h1>Hello World</h1>
<h2>My Name is Briana</h2>
<h3>I am your teacher</h3>
<p>This is my first year teaching these classes. All of my students are
wonderful and talented. <br/>They are all going to understand basic coding by the
end of this class. Oh, this is an example of a break tag that is dividing this
paragraph into two lines. Do you see it?</p>
<p>This is my second paragraph. As you can see, it is below my first
paragraph.</p>
</body>
</html>
18. Adding emphasis in a paragraph
<p>
This is my <i>first year</i> teaching these classes.
All of my students are <strong>wonderful and
talented.</strong>
They are all going to <em>understand</em> basic
<em><u>coding</em></u> by the end of this class.
</p>
19. Adding a line
• <hr/> - self closing tag
<html>
<head>
<title>Title of my Page</title>
</head>
<body>
<h1>Hello World</h1>
<h2>My Name is Briana</h2>
<h3>I am your teacher</h3>
<p>This is my first year teaching these classes. All of my students are wonderful and
talented. <br/>They are all going to understand basic coding by the end of this class. Oh, this is
an example of a break tag that is dividing this paragraph into two lines. Do you see it? </p>
<p>This is my second paragraph. As you can see, it is below my first
paragraph.</p>
<hr/>
<img src="http://uhaweb.hartford.edu/aschmidt/kitten11.jpg"/>
</body>
</html>
20. Creating Bulleted Lists
• To create a bullet pointed list we will use an
unordered list <ul></ul>
• The whole list is wrapped in UL tags and then all of the elements in the list are
wrapped in <li></li> tags
<html>
<head>
<title>Title of my Page</title>
</head>
<body>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
</body>
</html>
21. Creating Numbered Lists
• Instead of <ul></ul> you will use <ol></ol>
• The whole list is wrapped in OL tags and then all of the elements in the
list are wrapped in <li></li> tags
<html>
<head>
<title>Title of my Page</title>
</head>
<body>
<ol>
<li>Item 1</li>
<li>Item 2</li>
</ol>
</body>
</html>
22. Creating Definition Lists
• <dl></dl>
• The whole list is wrapped in dl tags and then all of the elements in the list are
wrapped in either <dt></dt> or <dd></dd>
<html>
<head>
<title>Title of my Page</title>
</head>
<body>
<dl>
<dt>term1</dt>
<dd>definition 1</dd>
<dt>term2</dt>
<dd>definition 2</dd>
</dl>
</body>
</html>
23. Adding an IMAGE
• Find an image on Google
• Click on it
• Click View Image (so the image is on it’s own page)
• Copy the URL
• Now we will add it to our code
24. Inserting Image from Web
<img src=“INSERTLINKHERE”/>
Resize the image (below)
<img src=“LINK” alt=“displaytext” style=“width: #; #;”>
25. Adding Image from Folder
• Create a file in your HTML folder titled IMAGES
• Save an image in the Images folder
• <img src=”images/TitleOfYourImage.jpg"
alt=”NameYourImage" style="width:#px; height:#px”/>
26. Add a video from
Youtube
Get the embed code from YOUTUBE
<iframe width=”#" height=”#" src=“YOUTUBE LINK HERE"
frameborder="0" allowfullscreen></iframe>
32. The <span> Element
• The <span> element is often used as a container for
some text.
• The <span> element has no required attributes, but both
style and class are common.
• When used together with CSS, the <span> element can
be used to style parts of the text:
33. The <span> Element
<!DOCTYPE html>
<html>
<body>
<h1>My <span style="color:red">Important</span>
Heading</h1>
</body>
</html>
35. HTML Text Size
<h1 style="font-size:300%;">This is a heading</h1>
<p style="font-size:160%;">This is a paragraph.</p>v
36. HTML Text Alignment
<h1 style="text-align:center;">Centered Heading</h1>
<p style="text-align:center;">Centered paragraph.</p>
37. HTML Background Color
• <!DOCTYPE html>
• <html>
• <body style="background-color:powderblue;">
• <h1>This is a heading</h1>
• <p>This is a paragraph.</p>
• </body>
• </html>
38. HTML Background Image from File
• YOU MUST HAVE YOUR FILE SAVES AS INDEX.HTML
<html>
<head> <title>Title of my Page</title>
<body background = ”images/watercolor.jpg">
*everything else
</body>
</html>
39. CSS
• CSS stands for Cascading Style Sheets.
• CSS describes how HTML elements are to be displayed
on screen, paper, or in other media.
• CSS saves a lot of work. It can control the layout of
multiple web pages all at once.
CSS can be added to HTML elements in 3 ways:
• Inline - by using the style attribute in HTML elements
• Internal - by using a <style> element in the <head>
section
• External - by using an external CSS file
40. Inline CSS
• <h1 style="color:blue;">This is a Blue Heading</h1>
41. Internal CSS
• An internal CSS is used to define a style for a single HTML page.
• An internal CSS is defined in the <head> section of an HTML page, within a <style>
element:
<html>
<head>
<style>
body {background-color: powderblue;}
h1 {color: blue;}
p {color: red;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
42. CSS Background Image from Link
<html>
<head> <title>Title of my Page</title>
<style>
body {
background-image: url(”LINKHERE");
}
</style>
</head>
<body>
43. CSS Border
<!DOCTYPE html>
<html>
<head>
<style>
p {
border: 1px solid powderblue;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
</body>
</html>
44. CSS Padding
<!DOCTYPE html>
<html>
<head>
<style>
p {
border: 1px solid powderblue;
padding: 30px;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
</body>
</html>
45. CSS Margin
<!DOCTYPE html>
<html>
<head>
<style>
p {
border: 1px solid powderblue;
margin: 50px;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
</body>
</html>
46. CSS id Attribute
<!DOCTYPE html>
<html>
<head>
<style>
#p01 {
color: blue;
}
</style>
</head>
<body>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p id="p01">I am different.</p>
</body>
</html>
47. CSS Class Attribute
<!DOCTYPE html>
<html>
<head>
<style>
p.different {
color: red;
}
</style>
</head>
<body>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p class=”different">I am different.</p>
<p>This is a paragraph.</p>
<p class=”different">I am different too.</p>
</body>
</html>
48. The <div> Element
• The <div> element is often used as a container for other
HTML elements.
• The <div> element has no required attributes, but both
style and class are common.
• When used together with CSS, the <div> element can be
used to style blocks of content:
49. The <div> Element
<!DOCTYPE html>
<html>
<body>
<p>This is some text.</p>
<div style="color:#0000FF">
<h3>This is a heading in a div element</h3>
<p>This is some text in a div element.</p>
</div>
<p>This is some text.</p>
</body>
</html>
50. The <div> Element
<!DOCTYPE html>
<html>
<body>
<div style="background-
color:black;color:white;padding:20px;">
<h2>London</h2>
<p>London is the capital city of England. It is the most
populous city in the United Kingdom, with a metropolitan
area of over 13 million inhabitants.</p>
<p>Standing on the River Thames, London has been a
major settlement for two millennia, its history going back
to its founding by the Romans, who named it
Londinium.</p>
</div>
</body>
</html>
51. <!DOCTYPE html>
<html>
<head>
<style>
div.cities {
background-color: black;
color: white;
margin: 20px 0 20px 0;
padding: 20px;
}
</style>
</head>
<body>
<div class="cities">
<h2>London</h2>
<p>London is the capital of England. It is the most populous city in the United Kingdom, with a metropolitan
area of over 13 million inhabitants.</p>
<p>Standing on the River Thames, London has been a major settlement for two millennia, its history going
back to its founding by the Romans, who named it Londinium.</p>
</div>
<div class="cities">
<h2>Paris</h2>
<p>Paris is the capital and most populous city of France.</p>
<p>Situated on the Seine River, it is at the heart of the Île-de-France region, also known as the région
parisienne.</p>
<p>Within its metropolitan area is one of the largest population centers in Europe, with over 12 million
inhabitants.</p>
</div>