Building Web Applications with HTML5, CSS3, and Javascript
Building Web Applications with HTML5, CSS3, and Javascript
Jason Clark
Head of Digital Access & Web Services
Montana State University Libraries
pinboard.in #tag
pinboard.in/u:jasonclark/t:lita-html5/
twitter #hashtag
#litahtml5
Overview
Android: -webkit-
Chrome: -webkit-
Firefox: -moz-
Internet Explorer: -ms-
iOS: -webkit-
Opera: -o-
Safari: -webkit-
Minification
• Removing unnecessary characters and
spacing from code to reduce size, and
optimizing the code to improve load times
CSS compressor
http://www.minifycss.com/css-compressor/
Box Sizing
• Set how the browser calculates the width of
an element to include (or not include)
padding, borders, and margins
div.doc {!
width: 200px;!
padding: 0 30px;!
-webkit-box-sizing: border-box; !
-moz-box-sizing: border-box;!
box-sizing: border-box;!
}!
Resize
• Set element to be resized vertically and/or
horizontally using a bottom-right UI handle
div.doc {!
overflow: hidden;!
-moz-resize: both; !
resize: both;!
}!
Rounded Elements
• border-radius declaration
• smooth out your interfaces
• button effects
ul > li!
Immediate descendant (child) selector!
body {!
background: !
url(../images/top-left.png) top left fixed
no-repeat, !
url(../images/bot-left.png) bottom left
fixed no-repeat, !
url(../images/bot-right.png) bottom right
fixed no-repeat;!
background-color: #2f2626;!
}!
CSS generated content
• Uses CSS content property
• Applied with :before or :after pseudo
elements
o :first-letter, :first-line (CSS 1 & 2)
o ::selection (CSS 3)
h1:before {
content: "I.";
}
a:after {
content: attr(href)
}
Transitions
• Animation behavior
• Scaling, fading, easing, etc.
body { !
!-o-transition:all .2s linear; !
!-moz-transition:all .2s linear; !
!-webkit-transition:all .2s linear;!
!transition:all .2s linear; !
}!
Transform
• Applies a 2D or 3D transformation to an
element
• Rotate, scale, move, etc.
li:hover { !
-moz-transform:scale(1.15);!
-ms-transform:scale(1.15);!
-o-transform:scale(1.15);!
-webkit-transform:scale(1.15);!
transform:scale(1.15);!
}!
position:fixed
• Create an element that stays in the same
position even after scrolling the page
nav {
position:fixed;
top:2%;
right:2%;
}
min/max-width/height
• Set and control the width and height of
element boxes.
• min-width, max-width, min-
height, max-height
main {
min-height: 480px;
height: 520px;
width: 100%;
}
Columns and Grids
• Layout and page structure
• Goodbye, float?
ul#content {!
-webkit-column-count: 3;!
-webkit-column-rule: 1px solid #eee;!
-webkit-column-gap: 1em;!
-moz-column-count: 3;!
-moz-column-rule: 1px solid #eee;!
-moz-column-gap: 1em;!
column-count: 3;!
column-rule: 1px solid #eee;!
column-gap: 1em;!
display: block;!
} !
Flexbox
• A flexible box model?
body>div#main {!
display: -webkit-flexbox; !
display: -moz-flexbox;!
display: -ms-flexbox;!
display: -o-flexbox;!
height: 500px;!
padding: 1em;!
background-color: gray;!
} !
@supports
• Detect support of CSS features directly in
CSS