230 likes | 324 Views
Ben Scheirman ben.scheirman@gmail.com Blog: http://www.flux88.com. Techniques for Better Web Development. Advanced CSS and JavaScript. Show of Hands. Favorite Browser? Internet Explorer Firefox Safari Opera. Browser Stats. HTML Recap. Common Tags: <div> <span>
E N D
Ben Scheirman ben.scheirman@gmail.com Blog: http://www.flux88.com Techniques for Better Web Development Advanced CSS and JavaScript
Show of Hands Favorite Browser? Internet Explorer Firefox Safari Opera
HTML Recap Common Tags: <div> <span> Lesser-known Tags: <label> <blockquote> <fieldset> <legend> <address> < abbr> Evil Tags: <font> <strike> <center> <u> Do I need a Doctype Header?
What is CSS? Purpose Benefits Why? But I’m a Developer!
Best Practices No inline styles Minimal page style blocks Reference external CSS file Use a DOCTYPE Validate!
Styling Text Use Font fall-backs font-family: Calibri, Lucida, Verdana, Arial em, not px Line-height, not height Text Decoration
Styling Links :<state>selector LoVe-Hate • a:link a:visited • a:hover a:active Rollover graphics
Styling Forms No tables! Use <fieldset> Use <label>
CSS for Layout What is page flow? Understand float Understand the box model
The Box Model Padding Content Margin
CSS Demos Box Model CSS Page Layout Prop-Clear Trick Pure CSS Tabs
Tips for success Develop in Firefox, not IE Validate! Switch browsers frequently
Possibilities CSS Zen Garden http://www.csszengarden.com CSS Layout Templates http://www.intensivstation.com
JavaScript Why? Why Not?
DOM Manipulation What is the DOM? What can JavaScript do with the DOM? document.getElementById(id); document.getElementsByTagName(tag); document.createElement(tag); element.setAttribute(attr, value) document.removeChildren(); document.appendChild(node); Avoid browser specific syntax such as document.all
There’s Help Firefox Tools Firebug Web Developer Toolbar JavaScript Frameworks MochiKit YUI Prototype scrip.taculo.us …more…
Meet MochiKit “Makes JavaScript SUCK LESS”
What if… JavaScript is disabled? Browser doesn’t support ______ ?
Progressive Enhancement ASP.NET Application When JavaScript is Disabled still functions When JavaScript is available, but limited experience improves When XMLHttpRequest is supported Ajax is used
Demo: • Forum Registration Page • CSS to style forms • Ajax to enhance the site
References • CSS Mastery by Andy Budd • DOM Scripting by Jeremy Keith www.csszengarden.com www.exploding-boy.com http://www.greywyvern.com/code/min-height-hack.html