Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Microsoft 70-480 Exam Study Guide

Microsoft 70-480 Exam Study Guide

Programming in HTML5 with JavaScript and CSS3

Table of Contents






This study guide is what I created prior to taking the Microsoft 70-480 test. There is a lot of shorthand and the code samples are not complete. I studied and read a couple of books prior to making this study guide. This guide does not include a lot of basic CSS, HTML, or JavaScript concepts. If you haven't learned about a topic in this study guide or the Microsoft 70-480 Skills Measured section I would recommend trying one of the books or resources below.

Books I read

Resources I used


Standard Selectors

button //element
* //universal selector, avoid
table td //descendent
div > p //child
div + h1 //subsequent adjacent sibling
div ~ h1 //subsequent sibling
a[href] //attribute
a[href='http://localhost'] //equals
a[href*='localhost'] //contains
a[href^='https'] //starts with
a[href$='.png'] //ends with
a[data-bind~='css'] //contains - space separated

Pseudo Classes

:target //ID at end of URL - e.g. ''

p:lang(en) {}
div p:nth-child(3n+2) {}

Pseudo Elements

::before //can set content
::after //can set content

#myParagraph::after {
	color: #FFF;
	content: 'test content';
#myParagraph::first-letter {
	font-weight: bold;


  1. browser - lowest precedence
  2. user
  3. author
  4. author !important
  5. user !important - highest precedence


a is most significant, followed by b, then c

  • a = # of id selectors
  • b = # of class, attribute, and pseudo class selectors
  • c = # of element selectors

Link Pseudo Class Selectors

Order is important

  1. a:link and/or a:visited
  2. a:hover
  3. a:active - when clicked

jQuery Selectors

:contains('blah') //matches elements containing the specified text
:header //h1, h2, etc.



  • fixed - positioned relative to view-port, taken out of flow
  • absolute - positioned relative to nearest positioned (non-static) ancestor, taken out of flow
  • relative - normal flow, then offset by top and left
  • static - default, normal flow


@font-face {
	font-family: "Some Name";
	src: local("Arial"),
	font-weight: bold;
p {
	font-family: "Some Name", Serif;


The initial and inherit values have been left off intentionally. The first value listed is the default.

/* determines how far background extends */
background-clip: border-box | padding-box | content-box; 
background-repeat: repeat | repeat-x | repeat-y | no-repeat;
border: 1px solid black;
border-radius: <top-left> <top-right> <bottom-right> <bottom-left>; //or just one
border-style: none | solid | dotted | dashed | double | groove | ridge | inset | outset;
box-sizing: content-box | padding-box | border-box;
clip-path: url(blah.svg#test1) | polygon() | rect() | circle() | ellipse();
columns: <min-column-width> <max-number-of-columns>; //column-count and column-width
font-weight: normal | bold | bolder | lighter | 100 | 200 | ... | 900 ;
font-style: normal | italic | oblique;
letter-spacing: normal | <length>;
opacity: <decimal in range 0 to 1>;
overflow: visible | hidden | scroll | auto; /* auto adds scroll bars if needed */
padding: <all> | <top&bottom> <left&right> | <top> <right> <bottom> <left>;
text-align: left | right | center | justify;
text-indent: <size>; /* first text in element */
text-shadow: <x-offset> <y-offset> <blur-radius> <color>;

Axis for x, y offsets

(0, 0)
    ----------- +x

Some properties such as color inherit by default. For other properties you can force inheritance by using the inherit value.


.classToAminate {
	    /* <name> <duration> <delay> <# of times> <fill mode> */
    animation: Your-Animation 5s 1s infinite backwards;
@keyframes Your-Animation {
      0% { opacity: 0.1; } /* can use 'from' instead of '0%' */
     50% { opacity: 0.2; }
    100% { opacity: 0.8; } /* can use 'to' instead of '100%' */


Supported by all latest browsers

.container {
    display: flex; /* or inline-flex */
    flex-direction: row | row-reverse | column | column-reverse;
    flex-wrap: nowrap | wrap | wrap-reverse;
    justify-content: flex-start | flex-end | center | space-between | space-around;
    /* for cross-axis */
    align-items: flex-start | flex-end | center | stretch | baseline;
    /* like justify-content for cross-axis, only applies when wrapping */
    align-content: flex-start | flex-end | center | space-between | space-around;
.item {
    order: <integer>; /* default 0 */
    flex-grow: <number>; /* default 0 */
    flex-shrink: <number>; /* default 1 */
    flex-basis: main-size | <length>; /* size before distributing space according to flex factors */
    flex: <flex-grow> <flex-shrink> <flex-basis>;
    /* overrides container align-items setting */
    align-self: auto | flex-start | flex-end | center | baseline | stretch;

Interactive demo that allows you to see how modifying properties affect the layout:

Grid Display

Only supported by IE currently, use -ms- prefix for IE 10.

display: ms-grid; /* IE 10 */
display: grid; /* or inline-grid */
/* column 1 = 100px wide, 2 = 2%, 3 = remaining space */
grid-columns: 100px 2% 1fr; 
grid-rows: auto 10px auto 10px auto; /* auto means content will determine size */
.header, .footer {
    grid-column-span: 3;
.header {
    grid-row: 1;
.footer {
    grid-row: 5;
.main {
    grid-column: 3;
    grid-row: 3;


Only supported with iframe sources in IE, use -ms- prefix. Chrome and Firefox don't support.

<div class="text">
    Blah blah blah...
<div class="containers"></div>
<div class="containers"></div>

.text {
    flow-into: text-flow; /* text-flow is an arbitrary name */
.containers {
    flow-from: text-flow;


wrap-flow: auto | clear | both | end | start;

2D Transforms

Use relative position on parent, absolute on child. Set child width to 100%.

    translate(x, y) /* e.g. translate(200px, 150px) */
    rotate(angle) /* e.g. rotate(30deg) */
    scale(sx, sy); /* e.g. scale(1.5, 2.2) */

3D Transforms

Use relative position on parent, absolute on child. Set child width to 100%.

perspective: 1000px; /* enables 3d space for children */

/* child styles */
transform-style: preserve-3d;
    perspective(500px) /* gives depth */

Media Queries

<link rel="stylesheet" media="screen and (min-width: 700px)" href="a.css"/>
@media screen {}
@media print {}
/* all is implied, not necessary */
@media all and (max-width: 699px) and (min-width: 520px), (max-width: 200px) {}


Basic Layout

<!DOCTYPE html>
    <meta charset="utf-8" />
    <title>A Title</title>
    <link href="css/style.css" rel="stylesheet" />
    <script src="js/test.js"></script>

Semantic Elements

  • section
  • nav
  • article - self contained
  • aside - loosely related, could be removed
  • header
  • footer
  • figure
    • figcaption
  • details - just the summary is displayed unless clicked
    • summary
  • strong
  • em
  • abbr - set title attribute
  • address - contact info for the author of a document
  • blockquote, q - use cite within for the name of the
  • code, samp - use white-space: pre to preserve white space
  • pre
  • var
  • wbr - suggested breaking point
  • dfn
  • dl - description list
  • dt, dd - term, description- don't nest
  • caption - table caption - first element in table

Form Validation

Name must be specified on the element for validation to work

  • type - email, date, number, range, color, search, tel, url
  • required
  • min, max, step
  • autofocus, placeholder
  • pattern - must match entire value - regex

App Cache

Including in html:

<html manifest="example.appcache">...</html>

The cache is cleared if the manifest changes, including a date is a good option. Example cache manifest file:

# 11/16/2014 
    index.aspx staticIndex.html
    images/ backup/notFoundImage.jpg


Scalable Vector Graphics. SVG example:

<svg width="500" height="300" xmlns="...">
    <path ... />
    <circle ... />
    <polygon ... />
    <rect ... />
    <text ... />
<!-- viewBox="minX minY x y" controls what portion of the image is displayed -->
<svg width="100%" height="100%" viewBox="0 10 15 15">...</svg>


<image src="test.svg" />


<video controls="controls" height="500">
    <source src="..." type="..." />
    <source src="..." type="..." />

Attributes: autoplay, controls, height, loop, muted, poster, preload, src, width


  • .ogv - not IE, iPhone, or Android
  • .webm - not iPhone
  • .mp4 - not Firefox or Opera


<audio id="test" controls="controls">
    <source src="..." type="..." />
    <source src="..." type="..." />
</audio >

Attributes: autoplay, controls, loop, preload, src


  • .oga/.ogg
  • .mp3,
  • .mp4/.mp4a/.aac
  • .wav

Using ogg and acc should give full browser support.


  <colgroup span="3">
      <col width="15px" />
      <col width="15px" />
      <col class="col3" />
  <colgroup span="1"></colgroup>
    <td>Column A</td>
    <td>Column B</td>
    <td>Column C</td>
    <td>Column D</td>



    url: 'url',
    type: 'POST',
    data: formData,
    async: true, //default is true
    cache: true, //default is true
    complete: someFunc, //called after success and error
    //error, password, success, username
}).done(function(data) {...}).fail(func).always(func);

Without jQuery

var request = new XMLHttpRequest();
request.onload = function test() {
};"get", "yourService", true /* async */);

Events: progress, load, error, abort, readystatechange Properties: responseText, responseXML, response, readyState, status


  • 2 - READYSTATE_LOADED - sent
  • 3 - READYSTATE_INTERACTIVE - some data received, still receiving

Serialization and Forms

$("form").serialize() //to URL encoded string
$("form").serializeArray() //to array of name value pairs
$.parseXML("string") //XML string to XML document that can be passed to jQuery to parse
encodeURI(str) //encodes string for use as a URL
encodeURIComponent(str) //encodes string for use in part of a URL
$.toJSON(data) //removed from jQuery in 1.9
JSON.stringify($("form").serializeArray()) //string [{"name":,"value":}] for POSTing

RegEx and Validation


var str = "test";
var re = /[a-z]+/; //or new RegExp("[a-z]+") to be dynamic
var array = re.exec(str);
var newStr = str.replace(re, "blah"); //access groups created with () by $1, $2, ... in the replacement string

Handy validation functions


Async with jQuery

Promises created from a $.Deferred() object

Deferred methods

  • resolve
  • resolveWith
  • notify
  • notifyWith
  • reject
  • rejectWith
  • promise

Promise methods

  • always
  • done
  • fail
  • pipe
  • progress
  • state
  • then

Web Workers

Non blocking, can't access DOM

var worker = new Worker("myWorker.js");
worker.onmessage = function(e) {
worker.onerror = function(e) {
worker.terminate(); //force kills without cleanup
//worker itself can call close()

Web worker timeouts and intervals

var timeoutId = setTimeout(func, delay /*ms*/);

var intervalId = setInterval(func, delay); //runs repeatedly

Web Messaging

Communication with other tabs, windows, and frames.

window.postMessage("message", "");
window.addEventListener("message", messageHandler, false /*capture*/);
function messageHandler(e) {
    if (e.origin == "") {

Web Sockets

TCP based, full-duplex continuous connection.

Functions: send, close, onclose, onerror, onmessage, onopen, porotocol, readystate, url, binaryType, bufferedAmount

var webSocket = new WebSocket(url);

function sendMessage() {
    if (webSocket.readyState !== WebSocket.OPEN) { return; }

webSocket.onmessage = function(e) {
    // use



  • SignalR - ASP.Net
  • Socket.IO - Node.js

Web Storage

localStorage and sessionStorage

localStorage["test"]; //same as localStorage.getItem("test")
localStorage["test"] = foo; //same as localStorage.setItem("test", foo);

storage event fires on any change

window.addEventListener("storage", storageHandler, false);

storage event object properties

  • key
  • oldValue
  • newValue
  • url
  • storageArea

Prototype Inheritance

var b = Object.create(a); //inherit from a

//same as Object.create()
function inherit(proto) {
  function F() {}     
  F.prototype = proto 
  return new F()      

for (var x in b) {
    if (object.hasOwnProperty(x)) { ... }



querySelector //first match - CSS selector

addEventListener(eventName, function, useCapture)
attachEvent(eventName, function) //older IE & Opera
removeEventListener(eventName, function, useCapture)
detachEvent(eventName, function) //older IE & Opera
var target = || event.srcElement; //srcElement is legacy IE only

//fire an event
var event = new Event("test");
element.fireEvent("on"+event.eventType, event); //IE9 and below

//iterate through object properties
for (var x in object) {
    if (object.hasOwnProperty(x)) { ... }
//use for loop for arrays

//execute function immediately, bind to 'this', arg1, arg2, ...);
func.apply(this, argArray);

//returns new function that is bound to 'this'
func.bind(this, arg1, arg2, ...);


new Array()
new Array('blah', 'test')
arr = ['blah', 'test']

.join() //blah,test - takes optional separator parameter
.pop() //removes last item, returns it
.push() //adds to end, can pass multiple items to add
.shift() //removes first item, returns it
.slice(start, end)
.sort(func) //func is optional
.splice(start, numToRemove, itemsToAdd, ...) //returns removed elements
.toString() //comma separated like join
.unshift() //adds to beginning, can pass multiple items to add
.valueOf() //comma separated like join

Geo-location API

Use navigator.geolocation object.

.getCurrentPosition(func(position){}, func(error){}, options);


  • coords
    • latitude
    • longitude
    • altitude
    • accuracy
    • altitudeaccuracy
    • heading
    • speed
  • timestamp


  • enableHighAccuracy
  • timeout - default is none (-1)
  • maximumAge in ms - default is no caching (0)
var watchId = .getWatchPosition(func(position){}, func(error){}, options);

function endWatch() {
    if (watchId !== 0) {
	    watchId = 0;

DOM Manipulation

parent.removeChild(item) //returns removed node
element.cloneNode(deep) //deep = whether or not to clone children
parent.appendChild(newChild) //adds to end of children
parent.insertBefore(newElement, elementToInsertBefore)
parent.replaceChild(newChild, oldChild) = "none"; = "hidden"; //still takes up space just not visible


element.className //space delimited string
element.classList //.add(), remove(), toggle(), contains()



<canvas id="a" width="200" height="150"></canvas>


var canvas = document.getElementById("a");
var context = canvas.getContext("2d");

.fillStyle, strokeStyle, lineWidth, lineJoin
.fillRect(x, y, width, height), strokeRect(...), clearRect(...)

.moveTo(x, y)
.lineTo(x, y)
//draws clockwise by default
//radians = (Math.PI/180)*degrees
.arc(x, y, radius, startAngle, endAngle, anti-clockwise) 
.arcTo(x1, y1, x2, y2, radius) //x0, y0 are current position draws from current position through arc
.stroke() //or .fill()

.font, textAlign, textBaseline
context.font = "bold 12px sans-serif";
context.fillText("test", 150, 200);

var gradient = context.createLinearGradient(x0, y0, x1, y1)
//.createRadialGradient(x0, y0, r0, x1, y1, r1)
gradient.addColorStop(0, "black"); //range 0 to 1
gradient.addColorStop(1, "white");
context.fillStyle = gradient;
context.fillRect(0, 0, 200, 100); //restore() - state context, stack

var image = new Image();
image.src = "...";
image.onload = function() {
    context.drawImage(image, x, y);

Drag and Drop

Set attribute draggable to true to allow element to be dragged. In most browsers links, images, and selected text are draggable by default.

Use css cursor: move to give a visual cue that the element is draggable.

Drag events

  • dragstart

  • drag //fires while element is being dragged

  • dragenter

  • dragleave

  • dragover

  • drop

  • dragend //fires when operation completes, whether or not it succeeded

    function handleDragStart(e) { dragSource = this; e.dataTransfer.effectAllowed = 'move'; e.dataTransfer.setData('text/html', this.innerHTML); }

    function handleDrop(e) { e.stopPropogation(); e.preventDefault(); if (dragSource !== this) { dragSource.innerHTML = this.innerHTML; this.innerHTML = e.dataTransfer.getData('text/html'); } }

Handle dragging from desktop to browser

function handleDrop(e) {
    var files = e.dataTransfer.files;
    for (var i = 0; i < files.length; i++) {
	    //read file objects

This comment has been minimized.

Copy link

@ITsvetkoFF ITsvetkoFF commented Jul 5, 2017



This comment has been minimized.

Copy link

@christianknu christianknu commented Nov 16, 2017

Very nice! thumbs up


This comment has been minimized.

Copy link

@lexneville lexneville commented Jan 29, 2020

This looks to be the most concise revision material I have found. Thanks!


This comment has been minimized.

Copy link
Owner Author

@rgharris rgharris commented Jan 29, 2020

Glad it could help! Do note that this has not been updated since 2014 so you may want to explore some of the forks and/or fork this yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment