Creative Computing Fall 2019

Reference

Table of contents

  1. HTML
  2. CSS
  3. Javascript
  4. Webserver - Python

1. HTML MDN Reference

HTML at its core is structural. It provides a machine readable document called the DOM with what content to display. This is central to elements we reference. Simply speaking, most elements require an open (<>) and close (</>) tag.

Some common reference tags:

A simple HTML file might look like this:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link href="css/style.css" type="text/css" />
  <title>COOL WEBPAGE</title>
</head>
<body>
  <!--CONTENT GOES HERE-->
  <div
  <script src="js/app.js" type="text/javascript"></script>
</body>
</html>

You can begin to plan your styles by adding classes or ids to your content HTML tags. We can do this very easily.

Of note:


2. CSS MDN Reference

CSS is the styling and presentational layer, it adds visual richness to the page on top of the structural base of HTML.

Don't forget to normalize your css, or each browser is left to it's default sizing. Normalizing standardizes our styles to be presentationally the same.

To reference the classes and ids that we gave our dom elements earlier, we would use the following:

HTML

<form id="contactform"></form>

CSS

#contactform {
  background: pink;
  max-width: 80%;
}

HTML

<button class="blue button big"></button>

CSS

.blue {
  background: blue;
}
.button {
  color: #fff;
  padding: 15px;
  text-transform: uppercase;
}

HTML

<section></section>

CSS

section {
  height: 100vh;
  margin: 0 auto;
  width: 100vw;
}

3. JavaScript MDN Reference

Making an HTML page interactive requires Javascript. Using event listeners, functions, variables, we have a technology that can traverse through the DOM and we can listen for events and respond to them using JavaScript.

const person = {
  firstName: "Dan",
  lastName: "Leatherman"
};
const kids = ["Simon", "Leo", "Willa"];
if (true) {
  // execute this code
}
if (false) {
  // do this
} else if (true) {
  // do this instead
}

4. Python Web Server Python Reference

  1. Open Terminal, make sure you are in the right directory, and paste the following command:
python -m SimpleHTTPServer 8000
  1. Open your browser to http://localhost:8000/ and you should see your index.html file running on a local webserver