Web Dev
Web Dev
Web Development
Definition:
- HyperText Markup Language
Syntax:
- <tag attribute=“value”> content </tag>
- Nested tags
- Each tag has a number of attributes
Internal model:
- Document Object Model
HTML5 Document
Headers
<h1>Header 1</h1>
<h2>Header 2</h2>
<h3>Header 3</h3>
Paragraph
<p>A paragraph of texts … </p>
Horizontal Lines
<hr>
Line Breaks
<br>
HTML5 Tags
Images
<img src=“images/apple.png”, alt=“Apple Image”>
Tables
<table>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
</table>
Links
<a href=“http://www.example.com”>Example</a>
<a href=“#biography”>Go to Biography</a>
HTML5 Tags
Lists
Ordered List
<ol>
<li>First, eat</li> <li>Second, sleep</li>
<li>Repeat the first</li>
</ol>
Unordered List
<ul>
<li>Eat</li> <li>Sleep</li>
</ul>
HTML5 Tags
Generic containers
<div></div>
- block element, i.e., line breaks before and after it
- container for virtually anything
<span></span>
- inline element
- container for text
HTML5 Tags
<header></header>
<footer></footer>
<aside></aside>
<section></section>
HTML5 Tags
<form>
<input type=“text” name=“username”>
<input type=“email” name=“email”>
<input type=“password” name=“password”>
<input type=“radio” name=“gender” value=“male”>
<input type=“radio” name=“gender” value=“female”>
<input type=“radio” name=“gender” value=“other”>
</form>
HTML to Forget
Use selectors:
Tags
p div span table h1 h2 …
Tips
Reference: https://css-tricks.com/the-difference-between-id-
and-class/
Looks and Feels
Size
Position
Layout
Reference: http://meyerweb.com/eric/tools/css/reset/
Size - Box Model
Margin By default,
Border width = width of content
height = height of content
Padding
Content Using
* { box-sizing: border-box; }
sets
width =
width of content + padding
height =
height of content + padding
Size - Box Model (demo)
div {
background-color: lightgrey;
width: 300px;
padding: 25px;
border: 25px solid navy;
margin: 25px;
}
padding
Size - Measurement Units
Pixels
e.g. 5px
position: static;
- Default position
position: relative;
- Relative to its default position
position: fixed;
- Relative to the viewport
position: absolute;
- Relative to its nearest positioned ancestor
(“positioned” <=> Anything but static)
Position - float
img {
float: right;
margin: 0 0 1em 1em;
}
Position - clear
.after-box {
clear: left;
}
Position - clearfix (demo)
img {
float: right;
}
.clearfix {
overflow: auto;
}
Inline-Block Layout
Demo
Media Query
References:
http://learnlayout.com/media-queries.html
https://developer.mozilla.org/en-US/docs/Web/Guide/
CSS/Media_queries
Resources
http://learnlayout.com/
http://www.w3schools.com/css/default.asp
JavaScript
Think Interaction
Canvas
Reference:
https://developer.mozilla.org/en-US/docs/Web/API/
Canvas_API/Tutorial
JavaScript
Reference:
https://developer.mozilla.org/en-US/docs/Web/
JavaScript/A_re-introduction_to_JavaScript
JavaScript
https://developer.chrome.com/devtools.
Tips
Sublime Text
http://www.sublimetext.com/
Atom
https://atom.io/
WebStorm
https://www.jetbrains.com/webstorm/