SlideShare a Scribd company logo
1 of 41
Download to read offline
FROM THEORY
TO PRACTICE
unspoken truth of starting web project
brought to you
by Sergey Bolshchikov
WHAT'S YOUR NAME, U SAID?
Front end Developer @ New ProImage
Co-organizer @ Ember-IL Meetup
Graduate Student @ Technion, IM&E
Web: http://bolshchikov.net
Blog: http://blog.bolshchikov.net
Github: https://github.com/bolshchikov
OUTLINE
1. Understand the destiny
2. Organize your life
3. Choose your comrades
4. Lay out your way
5. Add the make up
6. Bring some action
7. Coding
UNDERSTANDING THE DESTINY
DESTINY
DESTINY :: GOAL
The goal should formulate the main purpose or idea of future
project. It can be describe by one sentence or two sentences,
e.g.
“Create user-friendly web store for
selling fruits and vegetables”
DESTINY :: FUNCTIONALITY
● Login
● Display a list of available items with prices
● Display detailed information per item
● Be able to add the item to the basket
● Calculate the overall sum
● Send the order
DESTINY :: STRUCTURE
ORGANIZE YOUR LIFE
ORGANIZATION
Division by type
Separation of concerns
Complex
HTML5BOILERPLATE
Project started by Paul Irish (Google) for keepin'
best techniques for web project
http://html5boilerplate.com/
● Code structure
● File template (html, css, js)
● Comes with libraries: jQuery, Modernizr
● and other
CHOOSE YOUR COMRADES
COMRADES
How? Checklist:
○ Amount of watchers in Github (big)
○ Amount of forks on Github (medium)
○ Amount of issues on Github (small)
○ Amount of results on Stackoverflow
○ Amount of votes on Stackoverflow
COMRADES :: DOM
Why? Cross browser API is not the same
What? Relieves you from pain developments
Who? jQuery, Zepto, MooTools
Save yourself some time
DO NOT WRITE YOUR OWN
COMRADES :: UI & WIDGETS
What?
● Splitter
● Tree
● Accordion
● Context menu
● Dropdown
● Charts
● Calendar
● Grids
● Dialogs
Who?
● Twitter Bootstrap
● jQueryUI
● KendoUI
● Wijmo Components
● jqWidgets
● Dojo
COMRADES :: JS FRAMEWORKS
Why? JS mess, spaghetti code
What? Clean separation of concerns
Who? EmberJS, Backbone, Angular, etc.
How? Write test programs in each of them
http://todomvc.com/
LAYOUT YOUR WAY
WRITING APPROACH
LAYOUT :: LAYOUT 1 :: HTML
<header></header>
<div id="main"></div>
<footer></footer>
http://jsbin.com/anafap/9/edit
LAYOUT :: LAYOUT 2 :: HTML
<div id="left"></div>
<div id="center"></div>
<div id="right"></div>
http://jsbin.com/asehas/7/edit
LAYOUT :: LAYOUT 3 :: HTML
<header></header>
<div id="container">
<div id="left"></div>
<div id="right"></div>
</div>
<footer></footer>
http://jsbin.com/uvafam/6/edit
ADD THE MAKE UP
CSS
CSS is a super power
CSS :: SELECTORS
Selector Description Example
*
Matches any element.
E Matches any E element (i.e., an
element of type E).
a
E F Matches any F element that is a
descendant of an E element.
div a
E > F Matches any F element that is a
child of an element E.
div > a
E:first-child Matches element E when E is the
first child of its parent.
li:first-child
E:link
E:visited
Matches element E if E is the source
anchor of a hyperlink of which the
target is not yet visited (:link) or
already visited (:visited).
a:link
a:visited
CSS :: SELECTORS (cont.)
Selector Description Example
E:active
E:hover
E:focus
Matches E during certain user
actions.
a:active
a:hover
a:focus
E + F Matches any F element immediately
preceded by a sibling element E.
div + div
E[foo] Matches any E element with the
"foo" attribute set (whatever the
value).
div[data-id]
E[foo="warning"] Matches any E element whose "foo"
attribute value is exactly equal to
"warning".
input[type=”text”]
DIV.warning Language specific. (In HTML, the
same as DIV[class~="warning"].)
div.navigation
E#myid Matches any E element with ID equal
to "myid".
div#main
CSS :: BOX MODEL
CSS :: MORE
● display: [none, block, inline, table, inline-
block...],
● position: [absolute, fixed, relative],
● top: [number],
● left: [number],
● float: [left, right, none]
LAYOUT :: LAYOUT 1 :: HTML + CSS
HTML
<header></header>
<div id="main"></div>
<footer></footer>
CSS
header, footer {
border: 1px solid red;
height : 55px;
background-color: grey;
border-radius: 7px;
}
#main {
border-radius: 7px;
border: 1px solid red;
background-color: grey;
height: 90px;
margin: 10px 0 10px 0;
}
http://jsbin.com/anafap/7/edit
LAYOUT :: LAYOUT 2 :: HTML + CSS
HTML
<div id="left"></div>
<div id="center"></div>
<div id="right"></div>
CSS
div {
background-color: grey;
border-radius: 7px;
border: 1px solid red;
float: left;
margin: 0 5px 0 5px;
}
#left, #right {
width: 150px;
height: 250px;
}
#center {
width: 275px;
height: 750px; }http://jsbin.com/asehas/6/edit
LAYOUT :: LAYOUT 3 :: HTML + CSS
HTML
<header></header>
<div id="container">
<div id="left"></div>
<div id="right"></div>
</div>
<footer></footer>
CSS
#left {
width: 28%;
background-color: grey;
border: 1px solid red;
border-radius: 7px;
margin-right: 2%;
float: left;
}
#right {
width: 70%;
background-color: grey;
border: 1px solid red;
border-radius: 7px;
margin-left: 30%
}
http://jsbin.com/uvafam/6/edit
TIME TO CODE
JAVASCRIPT
"JavaScript is the Assembly language of WEB"
- Erik Meijer, Dutch computer scientist
JQUERY :: SELECTORS
$(selector).method()
For example, $(‘#list’) will return the elements which has the attribute id=”list”.
For more, see http://api.jquery.com/category/selectors/.
JQUERY :: DOM MANIPULATIONS
● $(selector).html()
● $(selector).append(html)
● $(selector).remove()
● $(selector).attr('myAttr', 'value')
● $(selector).removeAttr('myAttr')
● $(selector).css('width', 40)
● $(selector).addClass('my-class')
● $(selector).removeClass('my-class')
● $(selector).text()
● $(selector).val()
JQUERY :: AJAX
$.ajax({
url: ‘/api/posts’
type: ‘POST’,
data: {},
success: function () {},
error: function () {}
});
JQUERY :: EVENTS
● $(selector).click(function () {})
● $(selector).dblclick(function () {})
● $(selector).mousedown(function () {})
● $(selector).mouseup(function () {})
● $(selector).mouseover(function () {})
● $(selector).mouseenter(function () {})
● $(selector).mouseleave(function () {})
● $(selector).on(eventName,
function () {})
● $(selector).off(eventName,
function () {})
JAVASCRIPT :: GUIDELINES
Do not populate global space
Use namespaces: create one global variable, e.g. name of your app, and store
everything there.
window.YUI = {};
YUI.version = ‘0.3’,
YUI.start = function () {};
JAVASCRIPT :: GUIDELINES
Write JavaScript only in js file
Do NOT write it in HTML:
<a class=”add” onclick=”function () {}”>Add</a>
Instead use jQuery and register the click handler:
$(‘.add’).on(‘click’, function () {});
JAVASCRIPT :: GUIDELINES
Write small functions
JAVASCRIPT :: GUIDELINES
Write comments
QUESTIONS?

More Related Content

What's hot

Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
Yehuda Katz
 
Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007
Netvibes
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
tutorialsruby
 

What's hot (20)

Introduction to web components
Introduction to web componentsIntroduction to web components
Introduction to web components
 
PHP 5 Sucks. PHP 5 Rocks.
PHP 5 Sucks. PHP 5 Rocks.PHP 5 Sucks. PHP 5 Rocks.
PHP 5 Sucks. PHP 5 Rocks.
 
High-Quality JavaScript
High-Quality JavaScriptHigh-Quality JavaScript
High-Quality JavaScript
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
 
jQuery For Developers Stack Overflow Dev Days Toronto
jQuery For Developers Stack Overflow Dev Days TorontojQuery For Developers Stack Overflow Dev Days Toronto
jQuery For Developers Stack Overflow Dev Days Toronto
 
Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007
 
Introduction to Using PHP & MVC Frameworks
Introduction to Using PHP & MVC FrameworksIntroduction to Using PHP & MVC Frameworks
Introduction to Using PHP & MVC Frameworks
 
Developing large scale JavaScript applications
Developing large scale JavaScript applicationsDeveloping large scale JavaScript applications
Developing large scale JavaScript applications
 
JavaScript Performance Patterns
JavaScript Performance PatternsJavaScript Performance Patterns
JavaScript Performance Patterns
 
More Secrets of JavaScript Libraries
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Libraries
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQuery
 
Plone Interactivity
Plone InteractivityPlone Interactivity
Plone Interactivity
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
 
KMUTNB - Internet Programming 4/7
KMUTNB - Internet Programming 4/7KMUTNB - Internet Programming 4/7
KMUTNB - Internet Programming 4/7
 
Untangling8
Untangling8Untangling8
Untangling8
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
BDD - Writing better scenario
BDD - Writing better scenarioBDD - Writing better scenario
BDD - Writing better scenario
 
WordPress and Ajax
WordPress and AjaxWordPress and Ajax
WordPress and Ajax
 
lect9
lect9lect9
lect9
 
tut0000021-hevery
tut0000021-heverytut0000021-hevery
tut0000021-hevery
 

Similar to Web Projects: From Theory To Practice

Class 4 handout two column layout w mobile web design
Class 4 handout two column layout w mobile web designClass 4 handout two column layout w mobile web design
Class 4 handout two column layout w mobile web design
Erin M. Kidwell
 

Similar to Web Projects: From Theory To Practice (20)

Making Your Site Look Great in IE7
Making Your Site Look Great in IE7Making Your Site Look Great in IE7
Making Your Site Look Great in IE7
 
Introduction to Web Technologies PPT.pptx
Introduction to Web Technologies PPT.pptxIntroduction to Web Technologies PPT.pptx
Introduction to Web Technologies PPT.pptx
 
[O'Reilly] HTML5 Design
[O'Reilly] HTML5 Design[O'Reilly] HTML5 Design
[O'Reilly] HTML5 Design
 
Master page
Master pageMaster page
Master page
 
Widgets: Making Your Site Great and Letting Others Help - WordCamp Victoria
Widgets: Making Your Site Great and Letting Others Help - WordCamp VictoriaWidgets: Making Your Site Great and Letting Others Help - WordCamp Victoria
Widgets: Making Your Site Great and Letting Others Help - WordCamp Victoria
 
Front End Development for Back End Developers - Denver Startup Week 2017
Front End Development for Back End Developers - Denver Startup Week 2017Front End Development for Back End Developers - Denver Startup Week 2017
Front End Development for Back End Developers - Denver Startup Week 2017
 
Class 4 handout two column layout w mobile web design
Class 4 handout two column layout w mobile web designClass 4 handout two column layout w mobile web design
Class 4 handout two column layout w mobile web design
 
Day of code
Day of codeDay of code
Day of code
 
Developing a Web Application
Developing a Web ApplicationDeveloping a Web Application
Developing a Web Application
 
From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)
 
Shifting Gears
Shifting GearsShifting Gears
Shifting Gears
 
Bootstrap Workout 2015
Bootstrap Workout 2015Bootstrap Workout 2015
Bootstrap Workout 2015
 
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nlSource Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
 
Rapid application development
Rapid application developmentRapid application development
Rapid application development
 
Moving from Web 1.0 to Web 2.0
Moving from Web 1.0 to Web 2.0Moving from Web 1.0 to Web 2.0
Moving from Web 1.0 to Web 2.0
 
Five Pound App talk: hereit.is, Web app architecture, REST, CSS3
Five Pound App talk: hereit.is, Web app architecture, REST, CSS3Five Pound App talk: hereit.is, Web app architecture, REST, CSS3
Five Pound App talk: hereit.is, Web app architecture, REST, CSS3
 
Please dont touch-3.6-jsday
Please dont touch-3.6-jsdayPlease dont touch-3.6-jsday
Please dont touch-3.6-jsday
 
Designing and Developing Windowed Interfaces for Web Apps
Designing and Developing Windowed Interfaces for Web AppsDesigning and Developing Windowed Interfaces for Web Apps
Designing and Developing Windowed Interfaces for Web Apps
 
Reactive Type safe Webcomponents with skateJS
Reactive Type safe Webcomponents with skateJSReactive Type safe Webcomponents with skateJS
Reactive Type safe Webcomponents with skateJS
 
Html5
Html5Html5
Html5
 

More from Sergey Bolshchikov

More from Sergey Bolshchikov (13)

Onboarding for Software Engineers Done Right
Onboarding for Software Engineers Done RightOnboarding for Software Engineers Done Right
Onboarding for Software Engineers Done Right
 
Pragmatic React Workshop
Pragmatic React WorkshopPragmatic React Workshop
Pragmatic React Workshop
 
Microservices on the client side
Microservices on the client sideMicroservices on the client side
Microservices on the client side
 
ES2015 Quiz
ES2015 QuizES2015 Quiz
ES2015 Quiz
 
Talking code: How To
Talking code: How ToTalking code: How To
Talking code: How To
 
Values & Culture of Continuous Deliver
Values & Culture of Continuous DeliverValues & Culture of Continuous Deliver
Values & Culture of Continuous Deliver
 
Protractor: Tips & Tricks
Protractor: Tips & TricksProtractor: Tips & Tricks
Protractor: Tips & Tricks
 
Continuous Delivery for Front-End Engineers
Continuous Delivery for Front-End EngineersContinuous Delivery for Front-End Engineers
Continuous Delivery for Front-End Engineers
 
Зачем нужен EmberJS, если мне хвататет jQuery
Зачем нужен EmberJS, если мне хвататет jQueryЗачем нужен EmberJS, если мне хвататет jQuery
Зачем нужен EmberJS, если мне хвататет jQuery
 
Ember Reusable Components and Widgets
Ember Reusable Components and WidgetsEmber Reusable Components and Widgets
Ember Reusable Components and Widgets
 
AngularJS Basics with Example
AngularJS Basics with ExampleAngularJS Basics with Example
AngularJS Basics with Example
 
Backbone Basics with Examples
Backbone Basics with ExamplesBackbone Basics with Examples
Backbone Basics with Examples
 
JS Single-Page Web App Essentials
JS Single-Page Web App EssentialsJS Single-Page Web App Essentials
JS Single-Page Web App Essentials
 

Recently uploaded

call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Morcall Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
vikas rana
 

Recently uploaded (15)

$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
 
LC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdfLC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdf
 
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
 
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
 
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
 
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
 
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
 
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
 
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Morcall Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
 
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
 
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
 
Pokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy TheoryPokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy Theory
 
WOMEN EMPOWERMENT women empowerment.pptx
WOMEN EMPOWERMENT women empowerment.pptxWOMEN EMPOWERMENT women empowerment.pptx
WOMEN EMPOWERMENT women empowerment.pptx
 
The Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushThe Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by Mindbrush
 

Web Projects: From Theory To Practice

  • 1. FROM THEORY TO PRACTICE unspoken truth of starting web project brought to you by Sergey Bolshchikov
  • 2. WHAT'S YOUR NAME, U SAID? Front end Developer @ New ProImage Co-organizer @ Ember-IL Meetup Graduate Student @ Technion, IM&E Web: http://bolshchikov.net Blog: http://blog.bolshchikov.net Github: https://github.com/bolshchikov
  • 3. OUTLINE 1. Understand the destiny 2. Organize your life 3. Choose your comrades 4. Lay out your way 5. Add the make up 6. Bring some action 7. Coding
  • 6. DESTINY :: GOAL The goal should formulate the main purpose or idea of future project. It can be describe by one sentence or two sentences, e.g. “Create user-friendly web store for selling fruits and vegetables”
  • 7. DESTINY :: FUNCTIONALITY ● Login ● Display a list of available items with prices ● Display detailed information per item ● Be able to add the item to the basket ● Calculate the overall sum ● Send the order
  • 11. HTML5BOILERPLATE Project started by Paul Irish (Google) for keepin' best techniques for web project http://html5boilerplate.com/ ● Code structure ● File template (html, css, js) ● Comes with libraries: jQuery, Modernizr ● and other
  • 13. COMRADES How? Checklist: ○ Amount of watchers in Github (big) ○ Amount of forks on Github (medium) ○ Amount of issues on Github (small) ○ Amount of results on Stackoverflow ○ Amount of votes on Stackoverflow
  • 14. COMRADES :: DOM Why? Cross browser API is not the same What? Relieves you from pain developments Who? jQuery, Zepto, MooTools Save yourself some time DO NOT WRITE YOUR OWN
  • 15. COMRADES :: UI & WIDGETS What? ● Splitter ● Tree ● Accordion ● Context menu ● Dropdown ● Charts ● Calendar ● Grids ● Dialogs Who? ● Twitter Bootstrap ● jQueryUI ● KendoUI ● Wijmo Components ● jqWidgets ● Dojo
  • 16. COMRADES :: JS FRAMEWORKS Why? JS mess, spaghetti code What? Clean separation of concerns Who? EmberJS, Backbone, Angular, etc. How? Write test programs in each of them http://todomvc.com/
  • 19. LAYOUT :: LAYOUT 1 :: HTML <header></header> <div id="main"></div> <footer></footer> http://jsbin.com/anafap/9/edit
  • 20. LAYOUT :: LAYOUT 2 :: HTML <div id="left"></div> <div id="center"></div> <div id="right"></div> http://jsbin.com/asehas/7/edit
  • 21. LAYOUT :: LAYOUT 3 :: HTML <header></header> <div id="container"> <div id="left"></div> <div id="right"></div> </div> <footer></footer> http://jsbin.com/uvafam/6/edit
  • 23. CSS CSS is a super power
  • 24. CSS :: SELECTORS Selector Description Example * Matches any element. E Matches any E element (i.e., an element of type E). a E F Matches any F element that is a descendant of an E element. div a E > F Matches any F element that is a child of an element E. div > a E:first-child Matches element E when E is the first child of its parent. li:first-child E:link E:visited Matches element E if E is the source anchor of a hyperlink of which the target is not yet visited (:link) or already visited (:visited). a:link a:visited
  • 25. CSS :: SELECTORS (cont.) Selector Description Example E:active E:hover E:focus Matches E during certain user actions. a:active a:hover a:focus E + F Matches any F element immediately preceded by a sibling element E. div + div E[foo] Matches any E element with the "foo" attribute set (whatever the value). div[data-id] E[foo="warning"] Matches any E element whose "foo" attribute value is exactly equal to "warning". input[type=”text”] DIV.warning Language specific. (In HTML, the same as DIV[class~="warning"].) div.navigation E#myid Matches any E element with ID equal to "myid". div#main
  • 26. CSS :: BOX MODEL
  • 27. CSS :: MORE ● display: [none, block, inline, table, inline- block...], ● position: [absolute, fixed, relative], ● top: [number], ● left: [number], ● float: [left, right, none]
  • 28. LAYOUT :: LAYOUT 1 :: HTML + CSS HTML <header></header> <div id="main"></div> <footer></footer> CSS header, footer { border: 1px solid red; height : 55px; background-color: grey; border-radius: 7px; } #main { border-radius: 7px; border: 1px solid red; background-color: grey; height: 90px; margin: 10px 0 10px 0; } http://jsbin.com/anafap/7/edit
  • 29. LAYOUT :: LAYOUT 2 :: HTML + CSS HTML <div id="left"></div> <div id="center"></div> <div id="right"></div> CSS div { background-color: grey; border-radius: 7px; border: 1px solid red; float: left; margin: 0 5px 0 5px; } #left, #right { width: 150px; height: 250px; } #center { width: 275px; height: 750px; }http://jsbin.com/asehas/6/edit
  • 30. LAYOUT :: LAYOUT 3 :: HTML + CSS HTML <header></header> <div id="container"> <div id="left"></div> <div id="right"></div> </div> <footer></footer> CSS #left { width: 28%; background-color: grey; border: 1px solid red; border-radius: 7px; margin-right: 2%; float: left; } #right { width: 70%; background-color: grey; border: 1px solid red; border-radius: 7px; margin-left: 30% } http://jsbin.com/uvafam/6/edit
  • 32. JAVASCRIPT "JavaScript is the Assembly language of WEB" - Erik Meijer, Dutch computer scientist
  • 33. JQUERY :: SELECTORS $(selector).method() For example, $(‘#list’) will return the elements which has the attribute id=”list”. For more, see http://api.jquery.com/category/selectors/.
  • 34. JQUERY :: DOM MANIPULATIONS ● $(selector).html() ● $(selector).append(html) ● $(selector).remove() ● $(selector).attr('myAttr', 'value') ● $(selector).removeAttr('myAttr') ● $(selector).css('width', 40) ● $(selector).addClass('my-class') ● $(selector).removeClass('my-class') ● $(selector).text() ● $(selector).val()
  • 35. JQUERY :: AJAX $.ajax({ url: ‘/api/posts’ type: ‘POST’, data: {}, success: function () {}, error: function () {} });
  • 36. JQUERY :: EVENTS ● $(selector).click(function () {}) ● $(selector).dblclick(function () {}) ● $(selector).mousedown(function () {}) ● $(selector).mouseup(function () {}) ● $(selector).mouseover(function () {}) ● $(selector).mouseenter(function () {}) ● $(selector).mouseleave(function () {}) ● $(selector).on(eventName, function () {}) ● $(selector).off(eventName, function () {})
  • 37. JAVASCRIPT :: GUIDELINES Do not populate global space Use namespaces: create one global variable, e.g. name of your app, and store everything there. window.YUI = {}; YUI.version = ‘0.3’, YUI.start = function () {};
  • 38. JAVASCRIPT :: GUIDELINES Write JavaScript only in js file Do NOT write it in HTML: <a class=”add” onclick=”function () {}”>Add</a> Instead use jQuery and register the click handler: $(‘.add’).on(‘click’, function () {});