Intro to HTML/CSS

Quiz Part 1

Which tag is used to create a paragraph?

  1. <p>
  2. <div>
  3. <a>
  4. <link>
Answer: <p>

Quiz Part 2

What are the two tags that nest directly within the <html> tags?

Answer: <head> and <body>

Element: Heading

<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 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

* Heading number indicates hierarchy, not size. Think of outlines from high school papers

Example: Headings

Example of headings

Formatted text

    Here is a paragraph with <em>emphasized</em> text and <strong>important</strong> text.

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.

Enough Talk: Let's Code!

Your homework was to come up with a topic for your website

Let's add some content to our site about that topic!

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

Anatomy of an HTML element

  • Attribute
    • Provides additional information about the HTML element
    • Class, ID, language, style, identity, source
    • Placed inside an opening tag, before the right angle bracket.
  • Value
    • Value is the value assigned to a given attribute.
    • Values must be contained inside quotation marks.
    • <div id="copyright">©BizStream Academy logo 2016</div>
      <img src="my_picture.jpg" />
      <a href="">BizStream Academy</a>

Element: Link

Links have three components

  • Tag: <a></a>
  • Href attribute: ""
  • Title attribute: "BizStream Academy"
<a href="" title="BizStream Academy">BizStream Academy</a>

BizStream Academy

The <a> tag surrounds text or images to turn them into links

Link Attributes

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="">E-mail us!</a>

Adding mailto: directly before the email address means the link will open in the default email program.

Relative vs. Absolute paths for links & images

  • Relative
    Relative paths change depending upon the page the link is on.
    • Links within the same directory (folder) need no path information. "filename.jpg"
    • Subfolders are listed without preceding slashes. "img/filename.jpg"
  • Absolute
    • Absolute paths refer to a specific location of a file, including the domain. ""
    • Typically used when pointing to a link that is not within your own domain.

Enough Talk: Let's Code!

Let's add links to our site!

Add links that open in the same window, a new window and link to an e-mail address.

Element: Image

Images have three components

  • Tag: <img />
  • Src attribute: ""
  • Alt attribute: "BizStream Academy logo"
<img src=""
alt="BizStream Academy Logo"/>

* Notice: This tag is our first example of a stand-alone or "self-closing" element.

Enough Talk: Let's Code!

Let's add a few images to our page.

Be sure to upload your images to your site folder in Editey

To use relative paths

Go to your site folder on your Google Drive

Add a new folder titled "images". This is where you can upload your images

To use absolute paths

Find an image on Google

Right click on the image and select "Copy image address"

Element: Unordered and ordered lists

<li>List Item</li>
<li>AnotherList Item</li>
<li>List Item</li>
<li>AnotherList Item</li>

Unordered list (bullets)

  • List Item
  • Another List Item

Ordered list (sequence)

  1. List Item
  2. Another List Item

Lists: Examples

Lists can be used to organize any list of items.

Examples of lists

You'd be surprised how often lists are used in web design.

Enough Talk: Let's Code!

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!

Element: Div

  • Block level element. Each new div is rendered on a new line.
  • A division, or section of content within an HTML page.
  • Used to group elements to format them with CSS.
  • Apply IDs and Classes to divs to control their styles with CSS.

Div Examples

<div id="header">
     <h1>Main Heading<h1>
<div class="sub-content">
     <p>Some more content<p>

Grouping elements with div

  • The div tag is used everywhere to group elements together into sections.
  • You can wrap groups of elements in a div to style them differently.


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> Header Content </div>
<!-- End of header -->
<li>List Item</li>
<li>Another List Item</li>

Enough Talk: Let's Code!

Let's add some divs your site to separate content into different sections based off of your wireframe drawings.

Then add comments to organize your divs content.

Character codes

There are character codes for many different characters in many different languages

  • Delta: &delta; δ
  • Copyright symbol: &copy; ©
  • Grave: &grave; `
  • An grave a: &agrave; à
  • A full list is available at
Example of Characters

CSS: What is it?

CSS = Cascading Style Sheets

CSS is a "style sheet language" that lets you style the elements on your page.

CSS is works in conjunction with HTML, but is not HTML itself.

CSS: What can it do?

All colored text, position, and size

Screenshot of homepage

The CSS Rule

The CSS Rule

The CSS Rule

selector {
   property: value;
  • A block of CSS code is a rule.
  • The rule starts with a selector.
  • It has sets of properties and values.
  • A property-value pair is a declaration.

CSS Syntax

Declarations: Property and value of style you plan to use on HTML element.

Declarations end with a semicolon

Declaration groups are surrounded by curly brackets.

selector {
    property: value;
    property: value;
    property: value;

Connecting CSS to HTML

3 ways




Connecting CSS to HTML: Inline

<p style="color:red">Some text.</p>

Uses the HTML attribute style.

Difficult to use in large projects

Not preferred.

Connecting CSS to HTML: Embedded

<style type="text/css">
p {
    color: blue;
    font-size: 12px;

Inside <head> element.

Uses <style> tag.

Can only be used in one html file

Connecting CSS to HTML: Linked

<link rel="stylesheet" type="text/css" href="styles.css">
  • Shared resource for several pages.
  • Reduced file size & bandwidth
  • Easy to maintain in larger projects.
  • Preferred by nerds everywhere!

Enough Talk: Let's Code!

  • In Editey, select File > New > CSS File and name it styles.css
  • Add the link from the previous slide to the file in the head of your HTML file
  • Add the CSS rule below to the CSS file:
body {
    background-color: gray;

Selector: Element

p {
    property: value;

Selects all paragraph elements.

img {
    property: value;

Selects all image elements.

CSS Color Values

Your browser can accept colors in many different ways:

  • Color name (ex. red)
  • Hexadecimal value (ex. #FF0000)
  • RGB value (ex. rgb(255, 0, 0))
  • HSL value (ex. hsl(0, 100%, 100%))

The 17 standard colors are: aqua, black, blue, fuchsia, gray, grey, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow.

Property: Color

The color property changes the color of the text.

p {
    color: red;
    color: #ff0000;
    color: rgb(255, 0, 0);

Property: Background-color

The background-color property changes the color of the background.

p {
    background-color: black;
    background-color: #000000;
    background-color: rgb(0,0,0);

Enough Talk: Let's Code!

  • Add some rules to your css file
  • Change the font color and background color of different types of elements
  • Try selecting links, paragraphs, and lists

Property: Font-family

The font-family property defines which font is used. Each property can have one or more comma separated values.

p {
    font-family: "Times New Roman";
    font-family: serif;
    font-family: "Arial", sans-serif;

Specific font name

Generic name

Comma-separated list

Property: Font-size

The font-size property specifies the size of the font.

p {
    font-size: 12px;
    font-size: 1.5em;
    font-size: 2rem;
    font-size: 100%;





Property: Fonts (shorthand)

p {
    font-style: italic;
    font-weight: bold;
    font-size: 10px;
    font-family: sans-serif;
p {
    font: italic bold 10px sans-serif;

Enough Talk: Let's Code!

  • Change the fonts of your page
  • Try changing the font sizes and styles for different elements
  • Also try using Google Fonts to add a new font to your site


Don't forget your homework!