Just Enough Code

56
Web Design in 2016: Just Enough Code Mindy McAdams University of Florida

Transcript of Just Enough Code

Page 1: Just Enough Code

Web Design in 2016: Just Enough Code

Mindy McAdamsUniversity of Florida

Page 2: Just Enough Code

http://bit.ly/mm-just

These are files for you to use. I will refer to them throughout this presentation.

Page 3: Just Enough Code

Using software tools is like this.

Page 4: Just Enough Code

Using code is like this.

Page 5: Just Enough Code

WarningHTML, CSS and JavaScript have all evolved over the years.

Check carefully for a date on any tutorials or examples you use (books too), and teach your students to do the same.

Page 6: Just Enough Code

OutlineStep 1.Step 2. Step 3.

Step 4.

HTMLCSSUsing a text editor and managing files; document structureJavaScript and jQuery

Page 7: Just Enough Code

HTMLStep 1.

Page 8: Just Enough Code

https://jsfiddle.net/ A free, interactive site for experimentation, for learning the tags and how they operate.

Page 9: Just Enough Code

1) Start with 4 essential HTML tags for (in order from top): a main heading, a paragraph, an image, and a link.

Page 10: Just Enough Code

2) Fill each of the essential HTML tags with (respectively) a main heading, a paragraph, an image URL, and a link URL.

Page 11: Just Enough Code

3) Click the “Run” command in JSFiddle.

Page 12: Just Enough Code

4) View the outcome in the

JSFiddle “Result” pane.

Page 13: Just Enough Code

https://jsfiddle.net/ Free, and you can save your work indefinitely.

Page 14: Just Enough Code

5) Encourage students to add more HTML elements, then “Run” again to update the results.

Page 15: Just Enough Code
Page 16: Just Enough Code

HTML

JavaScript

CSS

Results

Page 17: Just Enough Code

HTML

JavaScript

CSS

Results

Page 18: Just Enough Code

CSSStep 2.

Page 19: Just Enough Code

Memorize and Teach ThisHTML marks up the structure of the document.Headings, paragraphs, images, links …

CSS is used to control design: all the visual effects and layout of elements.Color, margins, rules and borders, fonts ...

Page 20: Just Enough Code

Tip: Start CSS with colors, and apply them to HTML elements already used.

We’re still using JSFiddle and

clicking “Run” after changes to

see results.

Page 21: Just Enough Code

body refers to most of the visible page

h1a pair of h1 tags wraps the main heading at the top of the page

Beginner CSS

background sets the background color (this property can also be used for more)

color sets the foreground color only (text color)

Page 22: Just Enough Code

color.adobe.comStudents get pretty excited about this free site.

Page 23: Just Enough Code

While the students are playing with CSS colors, it’s a good time to introduce link styles.

aaffects all links on the page

a:hoveraffects each link when moused over

Page 24: Just Enough Code

After colors:

bordermarginpadding

Page 25: Just Enough Code

CSS Teaching Tips 1–41. Do not get into DIVs, HTML5 elements, or

positioning until students have experimented thoroughly with padding, margins, and borders.

2. Using borders is a great way to learn the different effects of margins and padding.

Page 26: Just Enough Code

CSS Teaching Tips 1–43. Require students to look up the “CSS box

model” and create a fiddle that uses borders and explains difference between margin and padding, with visual examples.

4. Do not teach fonts until later, when the students are working with real files and not JSFiddle.

Page 27: Just Enough Code

div Like duct tape, this element has thousands of uses. After a thorough workout with border, margin, and padding, have the students experiment with div tags.

Page 28: Just Enough Code

HTML

Page 29: Just Enough Code

CSS

Page 30: Just Enough Code

One Last CSS Teaching TipBeginners and computer-science types and random self-taught coders do many bad things with CSS. There are established Web standards that professionals follow and respect.Impress this upon your students.smashingmagazine.com is a good source.

Page 31: Just Enough Code

Using a text editor, managing files, document structure

Step 3.

Page 32: Just Enough Code
Page 33: Just Enough Code

Text editor:Atom is free, and excellent.https://atom.io

Page 34: Just Enough Code

Text editor:You must not use Notepad (Windows) or TextEdit (Mac), because they don't do the right things in the right way.

Page 35: Just Enough Code

Good Work Habits1. Always create a new folder for a new code project.2. Inside that folder, create three separate folders for

css, images, and scripts.3. Save all files into their proper folders.4. Do not save any project files outside that project’s

folder.

Page 36: Just Enough Code

A well-ordered project

Page 37: Just Enough Code

Document Structure<!DOCTYPE html><html> <head> <!-- meta tags, title, link tags --> </head>

<body> <!-- all content visible to users --> </body></html>

Page 38: Just Enough Code

The HTML head element<!DOCTYPE html><html> <head> <meta charset="utf-8"> <meta name="viewport"

content="width=device-width, initial- scale=1">

<title> Title for search engines </title> </head>

Page 39: Just Enough Code

Now your students can create complete standalone documents outside a content management system. They can create a site consisting of many pages, or a single-page application for web, mobile or both.

Page 40: Just Enough Code

Next Steps• Page layouts and responsive design/design for

mobile devices• Responsive images• Optimizing image file size for best

performance• Accessibility for people with disabilities

Page 41: Just Enough Code

JavaScript and jQueryStep 4.

Page 42: Just Enough Code

Why teach JavaScript and jQuery to beginners?

Tip: Never say "Java" when you mean JavaScript. They are not even related! Java is a completely different programming language.

Page 43: Just Enough Code

HTML

JavaScript

CSS

Results

Page 44: Just Enough Code
Page 45: Just Enough Code

The aim is to start students with JS code they can manipulate,

change, and run, to inspire them.

Page 46: Just Enough Code

The three blocks of jQuery code here each do the same thing, but each block is “listening” for a different action by the user.

Page 47: Just Enough Code

The first block of jQuery code “listens” for a change in the first text field.

Page 48: Just Enough Code

The second block of jQuery code “listens” for a change in the second text field.

Page 49: Just Enough Code

The third block of jQuery code “listens” for a change in the third text field.

Page 50: Just Enough Code

The paragraph below the three text fields changes whenever you change any of the fields and then leave it (return, enter, tab).

Page 51: Just Enough Code

There is no change until you leave the field (return, enter, tab).

Page 52: Just Enough Code

This jQuery example is explained in the “handout”

http://bit.ly/mm-justand there’s a link to the fiddle,

which you can play with.

Page 53: Just Enough Code

http://bit.ly/mm-just

Page 54: Just Enough Code

http://bit.ly/mm-just

Page 55: Just Enough Code

Most people learn code by looking at fairly simple scripts, playing with them, and modifying them. You don’t need to know everything to be able to do something.

Page 56: Just Enough Code

Web Design in 2016: Just Enough CodeMindy McAdams

University of [email protected]

Twitter: @macloo