CxD Archive
CxD 2020 Summer Workshop
CxD 2020 Summer Workshop
  • Computing by Design 2020
  • Schedule
  • About Us
  • Preparation
    • Workshop Tools
    • Slack Workspace
    • Programming Prep
  • Modules
    • Foundations
      • The CxD Approach
      • Mapping Innovative Practices
      • The CxD Project Framework
      • Programming Warm Up
      • A Teacher's Insight
    • Trivia Project
      • Define Problem & Propose Solution
      • Design & Build Solution (1/2)
      • Design & Build Solution (2/2)
      • Evaluate & Refine Solution
      • A Teacher's Insight
    • Chatbot Project
      • Define Problem & Propose Solution
      • Design & Build Solution (1/2)
      • Design & Build Solution (2/2)
      • Evaluate & Refine Solution
      • A Teacher's Insight
    • IoT Project
      • Define Problem & Propose Solution
      • Design & Build Solution (1/2)
      • Design & Build Solution (2/2)
      • Evaluate & Refine Solution
      • A Teacher's Insight
  • Your Project Plan
    • Guide to Project Plan
    • Final Review of Project Plan
  • Resources
  • Computing by Design Docs
  • Workshop Google Drive Folder
  • IN CS Standards K-12
  • US K12 CS Framework
  • IN Work-Based Learning Manual
  • IN Employability Skills
  • PBLWorks | About PBL
  • PBLWorks | More Resources
Powered by GitBook
On this page
  • HTML Basics
  • Try it out
  • Using CSS to Add Style
  • Try it out
  • Target Content with Classes and Id
  • Try it out
  • Hierarchy in HTML
  • Try it out
Export as PDF
  1. Modules
  2. Foundations

Programming Warm Up

PreviousThe CxD Project FrameworkNextA Teacher's Insight

Last updated 4 years ago

For our programming warm up we will use , because it is quick and easy to startup in the browser. For our projects, we will use , which is similar but provides many more features.

HTML Basics

HTML provides the structure for web pages and uses elements with tag names to differentiate items on the page. For example, <h1>...</h1> is a large heading element. Notice the opening tag <h1> and closing tag </h1> that indicates the beginning and end of the element. "h1" is the tag name in this case.

<h1>Favorite Technology Sites</h1>
<h3>MIT Technology Review</h3>
<p>The <a href="https://www.technologyreview.com/">MIT Technology Review</a> keeps me up to date on innovation.</p>

Try it out

  1. Add two more sites to the list with each having it's own "h3", "p", and "a" elements.

Using CSS to Add Style

h1 {
  color: red;
}
h3 {
  background-color: black;
  color: white;
}
p {
  font-size: 20px;
}

Try it out

  1. Modify the CSS by changing colors and font-size.

  2. Customize your look by adding the style properties below on the HTML elements you choose.

Target Content with Classes and Id

By assigning a class or id to an HTML element you can apply specific styles in a targeted way.

HTML
<div class="card" id="jill-card">Jill - Data Scientist</div>
<div class="card">Johnny - UX Designer</div>
<div class="card">Mia - Software Developer</div>
<div>Patrick - Business Analyst</div>
CSS
.card {
  padding: 5px;
  margin: 20px;
  background-color: lightgray;
  box-shadow: 2px 2px 3px;
}
#jill-card {
  background: yellow;
}

Try it out

  1. Take a look at the browser preview and try to decipher what is going on.

  2. Notice how assigning id="jill-card" in the HTML allows the element to be "targeted" with the CSS selector #jill-card.

  3. Notice how assigning class="card" in the HTML allows several elements to be "targeted" with the CSS selector .card.

  4. Go ahead and give Patrick's text a class of "card" and then add a unique id to his HTML element and some CSS to make his card stand out from all the others.

id - An HTML id is selected in CSS with a # prefix and should be used to target a single element on a page.

class - An HTML class is selected in CSS with a . prefix and can be used to select several elements that will share a common style.

Hierarchy in HTML

HTML
<div class="container">
  <div class="card">Jill - Data Scientist</div>
  <div class="card">Johnny - UX Designer</div>
  <div class="card">Mia - Software Developer</div>
</div>
CSS
.container {
  border: 1px dotted black;
  padding: 5px;
  background-color: lightyellow;
}
.card {
  padding: 5px;
  margin: 20px;
  background-color: lightgray;
  box-shadow: 2px 2px 3px;
}

Try it out

  1. Notice in the browser preview how the nesting becomes visually apparent.

  2. Also, notice how the indentation in the HTML is really helpful to see the proper structure. Technically the indentation does not need to be there, but it is a good programming practice.

  3. Add a parent <div> element with a class of "outer-container" to the container and style it with a solid border line. Use good indentation in your HTML.

Copy and past the HTML above into and notice how the browser preview looks.

Read these explanations on W3schools.com. , , and

CSS stands for cascading stylesheets and allows us to modify the appearance of HTML elements in a browser. Study to understand the syntax of CSS. It is important to understand the concepts of a selector, property, and value.

Copy the CSS code above and add it to your CodePen from the , and notice how the browser preview has changed.

- This one is cool.

Copy the HTML and CSS above and paste it in a .

Look at the HTML below. Do you see how the container could be called the parent of the three cards? The cards are then children of the container. This is an example of .

Copy the HTML and CSS above into a .

a new CodePen
Headings
Paragraphs
Links
this W3schools page
HTML Exercise
Border
Margin
Padding
Box-shadow
new CodePen
nested HTML
new CodePen
CodePen
repl.it