Copyright
September 2018, Zachary Wartell @ University of North Carolina at
Charlotte
All Rights Reserved.
Learning Objectives
Learn minimalist basics of HTML5
Learn minimalist basics of CSS
Learn minimalist basics of Event handling
Learn the basics of using Developer Tools in the Chrome web
browser
Overview
This course focuses on 2D/3D computer graphics and programming with
WebGL. WebGL runs in the context of a HTML5 web browser
environment with JavaScript. This tutorial selects a subset of
several on-line resources to cover the minimal amount of HTML5, CSS
and event handling required to get the most out of the book, WebGL
Programming Guide, that will be used in this class.
Tutorial Structure
This tutorial has 3 parts. Note, the parts are very different
in size and complexity.
Part 2 - Each student is required to either Option I or Option II below:
Option I - HTML, CSS, Event Handling:
This option is designed for students without experience in
either HTML, CSS, or HTML5 Event handling. If you
are missing any of these backgrounds you must complete
the entirety of Option I.
Option II - Description of Prior
Experience in HTML, CSS and Event Handling:
This option is designed for individuals who already have
programming experience in all three areas: HTML, CSS, and
HTML5 Event handling. "Part 2 - Option II " is very short
but must be completed if you choose Option II.
If you have not already done so, create
the following directory for your 6120
course work:
$ mkdir ITCS_6120
lucretius@monad42 ~/ITCS_6120 $ cd ITCS_6120
Clone your repo and enter the created
directory.
lucretius@monad42 ~/ITCS_6120 $ git clone URL of the 6120-html-tutorial
repo /6120-html-tutorial.git Cloning into '6120-html-tutorial' [...] $ cd 6120-html-tutorial
Inside the 6120-html-tutorial directory
create a text file called README.md.
Add your name on the first line of the file.
Git commit the file with commit message
"initial README.md"
Inside the above directory create a
second text file called Questions.txt.
Add your name on the first line of the
file.
Git commit the file with the commit message
"initial Questions.txt"
Some of the exercises in this tutorial may involve you answering
questions. You will write you answers in this file.
In the instructions below, you are required to make git commits at
specific points using specific commit messages. This is
a required part of the assignment. It
also introduces you to good git practices.
For a given exercise that
includes specific git commit instructions, if there is not at
least 1 git commit message associated with that exercise, 1 point
will be subtracted for "poor software development practices" for
that exercise.
The student’s commit message need not be a verbatim copy of the
commit message given in the exercise’s instructions, but it should
bevery similar. (But
you can simply cut & paste the messages, so they really should
be verbatim).
The grader will allow for a few of the required commit messages to
be missing without incurring a penalty.
Finally, extra commit's are perfectly fine and common practice,
such for fixing other types of coding mistakes, etc.
For exercises that require
students modify code already given to you, if only the original
example code is committed with no change & there is no
evidence from the student (documentation, notes, etc) of trying to
solve the exercise, then minimal points will be awarded for that
exercise.
The complete grading Rubric is available on Canvas.
Part 2:Option I - HTML, CSS, Event Handling
Part 2 : Option I is series of readning and exercises form the MDN doc's
on HTML, CSS and event handling.
Anatomy of an HTML element -
read this sub-section pausing to do the MDN "Active Learning"
exercises listed below:
Exercise:
Do "Active learning: creating your first HTML element
This exercise.does not require you add anything to your Git
repo.
Attributes- read this sub-section
and do the MDN "Active Learning" exercises listed below:
Exercise: Do "Active
learning: Adding attributes to an element
This exercise.does not require you add anything to your Git
repo.
Anatomy of a HTML document - read
all. However when you reach each Active Learning exercise
perform the exercise with the instruction modifications listed
below:
Exercise [anatomy-of-HTML]:
Do "Active learning: Adding some features to an HTML
document
Perform the entire exercise in a separate file, index.html,
as suggested in the Active Learning
instructions. Then:
Git commit the file with the message
"-exercise adding-a-title
Metadata: the <meta> element
- read all. When you reach each Active Learning exercise
perform the exercise with the instruction modifications listed
below:
Exercise [char-encoding]:
Do "Active learning: Experiment with character encoding
Perform the entire exercise by editing your file from the
previous exercise, title-example.html.
Save the file changes.
Git commit with the message
"-exercise char-encoding "
Exercise: Do "Active
learning: The description's use in search engines
This exercise.does not require you add anything to your Git
repo.
Adding custom icons to your site -
skip this sub-section
Applying CSS and JavaScript to HTML
- read all. When you reach each Active Learning exercise
perform the exercise with the instruction modifications listed
below:
Move all your modified Task
1 files to the above
directory.
Git commit the file with the message
"-exercise test your skills - Task 1"
Exercise: Task 2
Instead of updating the live code, follow the alternative
directions and download the starting point files for Task
2. Repeat the process in Task 1 for Task 2, but
create a directory test-your-skills-task-2.
Git commit the file with the message
"-exercise test your skills - Task 2"
Exercise: Task 3
Instead of updating the live code, follow the alternative
directions and download the starting point files for Task
2. Repeat the process in Task 1 for Task 3, but
create a directory test-your-skills-task-3.
Git commit the file with the message
"-exercise test your skills - Task 3"
CSS – Styling the Web
Next, you will read and work through sub-sections of the MDN topic
CSS —
Styling the Web.
Git commit the file with the message
"-exercise
started-with-CSS"
Adding_css_to_our_document
- read all.
When you reach each Active Learning exercise perform the
exercise with the instruction modifications listed below:
Exercise [add-CCS]: As
described in this MDN section, create various the files, style.css, etc. Place them in
your started-with-CSS
directory, modifying them as necessary.
Git commit with the message "-exercise add-CCS"
Styling_html_elements - read all.
When you reach each Active Learning exercise perform the
exercise with the instruction modifications listed below:
Exercise: Perform
described exercise on your local file instead of using the
embedded interactive editor
Git commit with the message
"-exercise Styling HTML elements"
Changing the default behavior of elements
- read all. When you reach each Active Learning exercise
perform the exercise with the instruction modifications listed
below:
Exercise [changing-behavior]:
As described in this MDN section, modify your previously
created the files .
Git commit the changes the message ""-exercise
changing-behavior""
Adding a class - read all.
When you reach each Active Learning exercise perform the
exercise with the instruction modifications listed below:
Exercise [adding-a-class]: As described in this MDN
section, modify your previously created the files
Git commit the changes the message ""-exercise
adding-a-class""
Exercise [styling-on-location]:
As described in this MDN section, modify your previously
created the files that you placed your sub-directory started-with-CSS.
Git commit the changes the message
"-exercise styling-on-location"
Skip the rest of the "Getting started with CSS" section.
Playing with the CSS in this article
- read all. When you reach each Active Learning exercise perform
the exercise with the instruction modifications listed below:
Exercise [playing-with-CSS]:
As described in this MDN section, create the files, index.html,
etc.
Git commit the file with the message
"-exercise
playing-with-CSS"
Selectors - read all. When you
reach each Active Learning exercise perform the exercise with
the instruction modifications listed below:
Exercise [selectors]: As
described in this MDN section modify the files in your
CSS-structure sub-directory.
Git commit the file with the message "-exercise
selectors"
Properties and values - read only
up but not including "Functions". When you reach each
Active Learning exercise perform the exercise with the
instruction modifications listed below:
Exercise [properties]: As described in this MDN
section modify the files in your CSS-structure
sub-directory.
Git commit the file with the message "-exercise properties"
@rules
and Shorthands - skip
both these sections.
Comments - read all. When you
reach each Active Learning exercise perform the exercise with
the instruction modifications listed below:
Exercise [comments]: As
described in this MDN section modify the files in your
CSS-structure sub-directory.
Git commit the file with the message "-exercise comments"
Examples_of_different_display_types - read all. When you reach
each Active Learning exercise perform the exercise with the
instruction modifications listed below:
Exercise [playing-box]:
This MDN section provides an interactive example that can be
done directly within the webpage's embedded interactive
editor.
After you accomplish the task using the embedded interactive
editor, copy your solution code into in a local file as
described next.
Inside the above directory, create a minimal working HTML
file, index.html, and then
insert your solution code that you developed in the embedded
interactive editor into index.html.
Git commit the file with the message "-exercise
different-display-types"
Playing_with_box_models - read up to but not
including "Use browser DevTools to view the box model". When you
reach each Active Learning exercise perform the exercise with
the instruction modifications listed below:
Exercise [playing-box]:
This MDN section provides an interactive example that can be
done directly within the webpage's embedded interactive
editor.
After you accomplish the task using the embedded interactive
editor, copy your solution code into in a local file as
described next.
Inside the above directory, create a minimal working HTML
file, index.html, and then
insert your solution code that you developed in the embedded
interactive editor into index.html.
Git commit the file with the message "-exercise
playing-with-box-models"
Skip the rest of "How CSS works"..
Event Programming (and a teeny bit of JavaScript)
This section guides you through reading about event handling, but
first it covers a teeny bit of JavaScript so as to better understand
the event handling tutorial. (A latter optional tutorial
in this course will cover JavaScript in depth).
Inside that sub-directory download and save the
example code (the link is given at the end the "A
high-level definition" section).
Verify the code displays correctly in Chrome.
Git commit the file with the message
"-exercise javascript-label
Using a text editor, change the code to display ‘First
Player’ instead of ‘Player 1’.
Modify the background color of the paragraph
style. Save your changes and verify the page
appears correctly in Chrome.
Git commit the file(s) with message:
"-exercise javascript-label"
After reading, online find any Third party API
not mentioned in the text. Write the API
name and the web address in your Questions.txt
file. Put the text "JS 1)" on the line above
your answer in the file.
Git commit the file(s) with message
"-exercise third-party-apis"
After reading, research on-line to find out how two
browsers (say Chrome and one other browser of
your choice) handles JavaScript. Is it
interpreted? Compiled? Some combination of
both?
Write your answers in your Questions.txt
file. Put the text "JS 2)" on the line above
your answer in the file.
Git commit the file(s) with message: "-exercise what is JS doing"
How do you add JavaScript to your page?
- read up to but not including "Script loading
strategies". When you reach each Active Learning exercise
perform the exercise with the instruction modifications listed
below:
While reading do the following exercises:
Exercise [internal-js]: Do
the exercise in sub-section "Internal JavaScript
This introduction to JavaScript should be enough in order to
complete the rest of this tutorial. A later tutorial
in the course will cover JavaScript in greater details.
Using addEventListener() - The
exercises in this MDN section are spread over multiple MDN
sub-sections. To clarify how you should submit these
activities to your git repo, the sub-sections are listed as
separate numbered steps below. Start by preparing a
directory as follows
Add additional listeners to some of the code in your random-color-addeventlistenerdirectory. Make the additional
listeners do something that is visible in the browser.
Git commit with message ""-exercise: multiple listeners""
Other event listener mechanisms -
read all. When you reach each Active Learning exercise
perform the exercise with the instruction modifications listed
below
Exercise [other-mechanisms]:
Modify some of the code in your random-color-addeventlistenerdirectory to
use event handler properties.
Git commit with message ""-exercise: other-mechanisms""
Event_Objects
- Read all and download the source code that this MDN section
refers to. When you reach each Active Learning exercise
perform the exercise with the instruction modifications listed
below:
Motify the code to show
a border of a few pixels on the button and also
randomly change the border color on each button click.
Git commit the file(s) with message: "-playing :)
Extra_properties_of_event_objects
- read all. When you reach each Active Learning exercise
perform the exercise with the instruction modifications listed
below:
Exercise [extra properties]:
Experiment with the embedded interactive editor exercise
This exercise.does not require you add anything to your Git
repo.
Exercise [key events]:
Modify some of the code in your random-color-addeventlistenerdirectory to
respond to 3 different key events. Make each
event handler trigger some visible change on the page.
Git commit with message: "-exercise: key_events"
Preventing_default_behavior
- Download the source code that this MDN section refers
to. As you read and you reach each active learning
exercises perform the exercises on the downloaded files and
inside the directory described below::
This exercise does not require you add anything to your Git
repo.
Exercise:
[bubbling-example Read and do the exercise in MDN
sub-section Bubbling_example
This exercise.does not require you add anything to your Git
repo.
Exercise:
[video-player] Read and do the exercise in MDN
sub-section Video_player_example.
Download the code from this link, video-player.html
and organize the
file(s) as follows:
Put all the file you created
in the above directory and verify result web page works
as expected in Chrome.
Git commit with message:
"-exercise: video-player"
Exercise:
[stop-propagation] Read and do the exercise in MDN
sub-section Fixing_the_problem_with_stop_propagation.
Apply the discussed changes to your code in your video-player
directory.
Git commit with message:
"-exercise: fixed propagation problem"
Exercise:
[event-capture] Read and do the exercise in MDN
sub-section Event_capture.
This exercise does not require you add anything to your Git
repo.
Event_Delegation
- Download the source code that this MDN section refers to. As
you read each active learning exercises perform the exercises on
the downloaded files and inside the directory described below:
Part 2 : Option II is only for students meeting the criteria discussed
in Section Tutorial Structure. In
your previously created README.md file, add the following:
List all courses you already took or are currently taking where
you learned HTML5, CSS, and Event Handling.
List any other experience you had outside of a class work where
you learned HTML5, CSS, and Event Handling.
Read all of the "Chrome DevTools" page -- but do not
follow any further hyperlinks. The goal is just to get a
rough idea of the functionality that the various "panels" provide.
View
DOM nodes - return to "Get Started With Viewing And Changing
The DOM" and continue reading sub-section "View DOM nodes
Exercises: Do all the exercises in this
sub-section. Regarding the further links embedded this
sub-section follow and read all them -- but skipGet
Started With Viewing And Changing CSS.
Take screenshot(s) of the rendered HTML page as it appears after
all your DOM changes. Save it to png file(s) named edit-DOM.png. If
needed, take multiple screen capture and save to multiple files
(edit-DOM-1.png, edit-DOM-2.png, etc.) in order to show the
entirety of the changes that occurred to the rendered HTML
page. (It's also acceptable to composite the
multiple screenshots into a single .png, if you prefer).
Set
up the demo and DevTools - As described in this Chrome doc
article set up the demo and DevTools. Read and do
all the exercises in this section.
Click the Settings Icon in the Console
().
Enable the check box |Preserve
Log|. Click the Settings Icon again to close
the Settings panel.
Exercise [save-log]:
Return to the Console window and
right click the mouse on any Console output line.
A pop-up menu will list an option |Save
As|. Select |Save
As|. This opens a dialog box to
save all the text that you typed in at the
Console.
Save the file to the directory, get-started-console that you
created the directory earlier.
Verify the file is saved to the
directory:
lucretius@monad42 ~/ITCS_6120/6120-html-tutorial/get-started-console
/ $ ls
developers.google.com-1535898597380.log [.your file name
will differ.]
lucretius@monad42 ~/ITCS_6120/6120-html-tutorial/get-started-console
/ $ cat
developers.google.com-1535898597380.log [cat displays the
file contents… your details will differ.]
document.getElementById('changeMyText') button
id="changeMyText">Change My Text/button
document.getElementById('changeMyText').textContent
= 'Hello' VM378:1 Uncaught TypeError: Cannot set
property 'textContent' of null [... the rest of
log file will appear here ... ]
Git commit the above file(s) with
commit message: "-exercise get-started-console #1
Read and do all the exercises this section. Then save the
console output log:
Exercise [save log]:
Return to the Console window
and right click the mouse on any Console output line.
A pop-up menu will list an option |Save
As|. Select |Save
As|. This opens a dialog box to
save all the text that you typed in at the
Console.
Save the file to the directory,
get-started-console that
you created the directory earlier.
Verify the file is saved to the
directory (as discussed earlier)
Git commit the above file(s)
with commit message: "-exercise get-started-console #2
Return to the Console window
and right click the mouse on any Console output
line. A pop-up menu will list an option |Save As|.
Select |Save As|.
This opens a dialog box to save all the text that you
typed in at the Console.
Save the file to the directory,
get-started-console that
you created the directory earlier.
Verify the file is saved to the
directory (as discussed earlier)
Git commit the above file(s)
with commit message: "-exercise get-started-console #3"
Click the Settings Icon in the Console
().
Enable the check box Preserve Log,
(if it’s not already enabled). Click
the Settings Icon again to close the Settings panel.
Return to the "Console" window and
right click the mouse on any Console output line. In
the pop-up menu, select |Clear console|.
Now read the entire DevTools Run
JavaScript in the Console article and work through all the
examples. (You do not have to follow every link
within this article, it's up to you).
When you are done, save the console log as follows:
Exercise [save log]:
Return to the "Console" window
and right click the mouse. In the pop-up menu,
select |Save As|.
This opens a dialog box to save all your interactions on
the Console.
Save the file to the directory,
get-started-console that
you created the directory earlier.
Verify the file is saved to the
directory (as described earlier)
Git commit the above file(s)
with commit message:
"-exercise javascript-console"
Reminder: git push your local repo to the server and give the TA
and professor reporter access.
RubricFixed max error in rubric
Part 1: 5 pts
Part 2
Option I: 55
Option II: 5 pts
Part 3: 40
Total:
with Option I: 100 pt
with Option II: 50 pt
Detailed Grader Version
The Grader Version of the Rubric is still under construction.
Section
Item
Category
Link
Check
Fraction
Points
Awarded
Comments
Total:
Academic Integrity
See the course syllabus regarding partial credit and the late penalty
policy.
This is an individual student project. Each student
should be writing and submitting their own code.
Students can discuss general aspects of the various API's and tools
with each other and this is strongly encouraged.
Discussing algorithm's at the pseudo-code level is also acceptable.
However, it is not permissible:
to copy code from other students
copy code implementing entire functions or entire algorithms from
Internet resources other than the resources explicitly referenced in
this tutorial
to copy code from other students from prior semesters
translate an algorithm found on the Internet implemented in
programming X and re-write it in language Y.
If you have questions about whether using a particular resource is
acceptable or not, email the TA and/or Professor.
Appendix: Notes for TA and Professor
This
section should NOT be distributed to students when the file is
printed to a PDF