introduction to web development

57

Upload: alberto-romeu-carrasco

Post on 10-May-2015

288 views

Category:

Technology


0 download

DESCRIPTION

Introduction to web development slides during the 4th UdG - SIGTE Summer School

TRANSCRIPT

Page 1: Introduction to web development
Page 2: Introduction to web development

INTRODUCTIONTO WEB

DEVELOPMENTAlberto Romeu - @alrocarJorge Sanz - @xurxosanz

Page 3: Introduction to web development

AGENDA1. HTML (15')2. CSS (15')3. JavaScript (60')4. Lab (30')

Page 4: Introduction to web development

WEBDEVELOPMENT

TOOLSA text editorA browserA web server

Page 5: Introduction to web development

INTRO TO HTMLHyper Text Markup LanguageStandard for writing web pagesHTML Tags - 1991HTML 2.0 - 1995HTML 4.0 - 1997HTML 5.0 - ¿2014?

Page 6: Introduction to web development

WHAT IS HTML?WEB PAGES that run in a web browser (client side)

<html>

<head> <meta charset="utf-8" /> <title>A tiny document</title> </head>

<body>

<p>My dog ate all the guacamole.</p>

</body></html>

Page 7: Introduction to web development

THE DOCUMENTTREE

Page 8: Introduction to web development

TAGS<tag>content</tag>

<span style="font-family: monospace;"><!--paragrapah--></span>

<span style="font-family: monospace;"><p>This is text within a paragraph.</p></span><br>

<br>

<!--nested tags-->

<p>I <strong>really</strong> mean that</p><br>

<br>

<!-- single elements -->

<img src="smileyface.jpg" /><br>

Page 9: Introduction to web development

ATTRIBUTES<tag attributeName="attributeValue">content</tag>

<p id="myinput">

<br>

<p class="foo"><br>

<br>

<img src="picture.gif" width="40" height="20" alt="I am a picture" />

Page 10: Introduction to web development

HEAD<head>

<meta name="keywords" content="HTML, CSS, JavaScript"><meta name="description" content="Intro to web dev"><meta name="author" content="Alberto Romeu"><meta http-equiv="refresh" content="30">

<title>Title of the document</title><br>

</head>

Page 11: Introduction to web development

BODY <body>

Write here the content of your web page

</body>

Page 12: Introduction to web development

HEADING <h1>I'm a very big heading</h1>

<br>

<span style="font-family: monospace; font-size: 19.662282943725586px; font-style: normal; font-variant: normal;"> <h2>I'm a quite big heading</h2></span><br>

<span style="font-family: monospace; font-size: 19.662282943725586px; font-style: normal; font-variant: normal;"><br></span>

<span style="font-family: monospace; font-size: 19.662282943725586px; font-style: normal; font-variant: normal;"> <h3>I'm a big heading</h3></span><span style="font-family: monospace; font-size: 19.662282943725586px; font-style: normal; font-variant: normal;"><br></span>

<span style="font-family: monospace; font-size: 19.662282943725586px; font-style: normal; font-variant: normal;"><br></span>

<span style="font-family: monospace; font-size: 19.662282943725586px; font-style: normal; font-variant: normal;"> <h4>I'm a heading</h4></span><span style="font-family: monospace; font-size: 19.662282943725586px; font-style: normal; font-variant: normal;"><br></span>

<span style="font-family: monospace; font-size: 19.662282943725586px; font-style: normal; font-variant: normal;"><br></span>

<span style="font-family: monospace; font-size: 19.662282943725586px; font-style: normal; font-variant: normal;">.</span>

<span style="font-family: monospace; font-size: 19.662282943725586px; font-style: normal; font-variant: normal;">.</span>

<span style="font-family: monospace; font-size: 19.662282943725586px; font-style: normal; font-variant: normal;">.</span>

Page 13: Introduction to web development

PARAGRAPH<p> Here’s a paragraph.</p><p> And here’s a different one. It’s as simple as that.</p>

Page 14: Introduction to web development

LINE BREAK I’d like to write some text<br>and then have the next bit on the line below.

Page 15: Introduction to web development

span<p>Here’s a paragraph of text. What I want to happen is to make <span style="font-weight:bold;"

Page 16: Introduction to web development

link <a href="http://www.prodevelop.es" target="blank">This is a link</a>

Page 17: Introduction to web development

IMAGE<img src="picture.jpg" width="104" height="142" />

<br>

<a href="http://www.prodevelop.es" target="blank">

<span style="font-family: monospace;"> <img src="picture.jpg" width="104" height="142"/></span>

</a>

Page 18: Introduction to web development

DIVHere’s some content…<div>This is a div.</div><div>And this is another one. Works pretty much like a new paragraph for now.</div>Here’s some more content…

Page 19: Introduction to web development

TABLE<table border="1"> <tr> <th>Header 1</th> <th>Header 2</th> </tr> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td>row 2, cell 2</td> </tr></table>

Page 20: Introduction to web development

list<ul> <li>Coffee</li> <li>Milk</li></ul>

<br>

<ol> <li>Coffee</li> <li>Milk</li></ol><br>

Page 21: Introduction to web development

html layouts<!DOCTYPE html><html><body>

<div id="container" style="width:500px">

<div id="header" style="background-color:#FFA500;"><h1 style="margin-bottom:0;">Main Title of Web Page</h1></div>

<div id="menu" style="background-color:#FFD700;height:200px;width:100px;float:left;"<b>Menu</b><br>HTML<br>CSS<br>JavaScript</div>

<div id="content" style="background-color:#EEEEEE;height:200px;width:400px;float:left;"Content goes here</div>

<div id="footer" style="background-color:#FFA500;clear:both;text-align:center;">I'm the footer</div>

</div>

</body></html>

Page 22: Introduction to web development

FORM AND INPUT<form>First name: <input type="text" name="firstname"><br>Last name: <input type="text" name="lastname"></form>

<br>

<form name="input" action="html_form_action.php" method="get">Username: <input type="text" name="user"><input type="submit" value="Submit"></form><br>

Page 23: Introduction to web development

IFRAME <iframe src="demo_iframe.htm" width="200" height="200"></iframe>

Page 25: Introduction to web development

INTRO TO CSSCascading Style SheetsStandard for styling HTML elementsCSS 1 1996CSS 2 1998CSS3 2012Browser support!! http://caniuse.com/

Page 26: Introduction to web development

INTERNALSTYLESHEET

<head><title><title><br>

<style type=”text/css”>CSS Content Goes Here</style><br>

</head><body>

Page 27: Introduction to web development

EXTERNALSTYLESHEET

<head><title><title><br>

<link rel=”stylesheet” type=”text/css” href=”style.css” /><br>

</head><body>

Page 28: Introduction to web development

INLINE STYLES <p style=”color: #ff0000;”>Some red text</p>

Page 29: Introduction to web development

CSS SYNTAXselector { property: value }

body { background: #eeeeee; font-family: “Trebuchet MS”, Verdana, Arial, serif;}

Page 30: Introduction to web development

INHERITANCEbody {font-family: Verdana, serif;}

h1 {font-family: Georgia, sans-serif;}p {font-family: Tahoma, serif;}

Page 31: Introduction to web development

TAG SELECTOR <p>this is a paragraph</p>

<span style="font-family: monospace;"> </span><span style="font-family: monospace;"

Page 32: Introduction to web development

CLASS SELECTOR <span> <span class="greentext">I'm green</span></span>

.greentext {

font-size: small;

color: #008080;

}

Page 33: Introduction to web development

id selector<div id="container">

This is a div

</div>

#container {

width: 80%;

margin: auto;

padding: 20px;

background: #ffffff;

border: 1px solid #666;

}

Page 35: Introduction to web development

PROPERTIES CSS 2.1 properties

Comprehensive list of properties

Page 37: Introduction to web development

INTRO TOJAVASCRIPT

Scripting programming languageClient side (also server side)Interpreted (runtime evaluation)JavaScript 1.0 - 1996Javascript 1.8.5 - 2010

Page 38: Introduction to web development

JAVASCRIPT INHTML

<script type="text/javascript">

</script>//JavaScript goes here

<script src="whatever.js" type="text/javascript"></script>

Page 39: Introduction to web development

JAVASCRIPT LAB

Page 40: Introduction to web development

JSONJavaScript Object NotationPlain TextHuman readableJSON.parse(), JSON.stringify()Faster, shorter, easier... than XML

Page 41: Introduction to web development

THE DOCUMENTTREE

Page 42: Introduction to web development

DOMDocument oBJECT MODEL

Access with JavaScriptBetter with jQuery

Page 43: Introduction to web development

DOMvar element = document.getElementById("theID");

document.getElementByClass('a');

<br>

element.innerHTML = "Write the HTML";

<br>

element.style.color = "blue";

Page 44: Introduction to web development

WEBPROGRAMMING

LAB

Page 45: Introduction to web development

Complete the HTMLSet the title of the web pageAdd the link tag to import the profile.css fileAdd the script tag to import the profile.js fileAdd a VERY BIG header in the div 'container' with the id'myname'

Page 46: Introduction to web development

COMPLETE THECSS

Change the body color to #444Set the container width to 800pxCreate a style for h2 tags

Change the weight, size and color of the font

Page 47: Introduction to web development

COMPLETE THEJAVASCRIPTOpen the profile.jsWrite the code necessary after the comments

Page 48: Introduction to web development

libraries vs

micro-frameworks VS

TOOLKITS

Page 49: Introduction to web development

JAVASCRIPTLIBRARIES

A collection of functionality you can call.Integrated.Tested

BIG

Page 50: Introduction to web development

JAVASCRIPT MICRO-FRAMEWORKS

Solves a single problemModularNot always integratedSmall

http://microjs.com/

Page 51: Introduction to web development

javascript toolkitsSeveral libraries together Set of components you can use (or not) Integrated

BIGGER

Page 52: Introduction to web development

widgetSjQuery UIExtJSMochaUIDijit

Page 53: Introduction to web development

GraphicalD3RaphaelKineticThree

Page 54: Introduction to web development

MAPPINGOpenLayersLeafletJS (MF)ModestMaps (MF)PolyMapS

Page 55: Introduction to web development

MAPPING GUIMapQuery (jQuery)GeoExt (ExtJS)