Professional Documents
Culture Documents
Copyright 2008
Overview
INTRODUCTION
Web Engineering (703512) 4
Basic Ingredients
Presentation
CSS
with these 3 elements you can start building nice (content static) interfaces for you web applications
W3C
Set Standards
Syntax Functionality
HTML Advantages
Platform Portability Speed (size of file) Text File
HTML Disadvantages
Rendering Differences E t Extensions i
Proprietary Functionality Added by Browsers
XHTML Advantages
Resolve Issues with Different HTML Versions
Syntax
Elements (Tags)
Codes that Control Content Appearance Opening/Closing
Two-Sided
<tagName>Content</tagName>
One-Sided
<tagName />
Lowercase
Deprecated
Obsolete Elements or Syntax Future Support Not Guaranteed
10
Syntax
Comments
<!-- . . . -->
<!-- This is a comment. -->
White Space p
Does Not Render Multiple Spaces Tab, Enter do not Render Use Non breaking Space Non-breaking
Attributes
Controls Behavior or Appearance of Element
<tagName attrib#1=Value attrib#2=Value />
11
<html>
<html></html>
Surround All Markup & Text Required Used To Begin & End Every HTML Document g y
12
<head>
<head></head>
Contains the Document's Header Information Required Important Information p
Document Title META Tags
13
<body>
<body></body>
Contains All Content to be Rendered
Attributes
leftmargin=number leftmargin number
Sets The Left Margin for Page
topmargin=number
Sets the Top Margin for the Page
14
<body>
Styles
style=color: colorName | #rrggbb | rgb(#,#,#);
Specifies the Color of the Regular Text
style=background-image: url(filename.ext);
Points to Location of Image that is Used as Background Image is Tiled
15
<body>
Styles
style=background-position: horizontal vertical;
Specifies the Positioning of the Background Image Can Specify Keywords or Percentages
16
<h#>
<h#></h#>
Create a Heading Numbered from h1 through h6
h1 is the Top Head Level While h6 is the Bottom
Should not be Used for Text Formatting Convey Page & Content Organization Should be Used in Descending Order
Style
style=text-align: left | center | right | justify;
Specifies the Alignment of the Heading Text
17
<p></p>
Inserts Blank Line Before Tag
Separates Paragraphs of Text
<br />
Causes Text To Break Wherever Tag is Placed
18
Lists
<ul></ul>
Unordered List Renders a Bulleted List Use Where Order or Rank is Unimportant
Style
style=list-style-type: disc | square | circle;
Changes Style of Bullet Before Item
19
Lists
<ol></ol>
Ordered List Tags Render a Numbered List
Style
style=list-style-type: decimal | upper-roman | upper-alpha | style list style type: upper roman upper alpha . . .;
Changes Number / Letter Style Before Item
20
Lists
<li></li>
Defines an Item in a List
<dl></dl>
Definition List <dt></dt>
Defined Term
21
<blockquote></blockquote>
Content Indented on Left & Right
<pre></pre>
Retains All White Space Uses Fixed Width Typeface
22
Inline Elements
<strong></strong> or <b></b>
Bold
<em></em> or <i></i>
Italics
<sub></sub>
Subscripted
<sup></sup>
Superscripted
23
Inline Elements
<span></span>
Used for Applying CSS Classes
Nesting
Placing Sets of Tags Within Each Other
<b><i></i></b> instead of <b><i></b></i>
24
<img>
<img />
Inserts an Image Into a Document Secondary to Content
Attributes
alt=text
Provides Alternative Text that Describes the Image IE Displays ALT Text When User Hovers on Image
Users Who Surf With Graphics Turned Off Non-graphical Browsers
Alt Text is Displayed in Place of Image
Required
25
<img>
Attributes
height=pixels
Specifies the Image's Height
src=URL
Specifies Location of Image to Place in Web Page Required
width=pixels
Specifies the Image's Width
26
<img>
Style
style=float: none | left | right;
Place Image on Left / Right & Wrap Text Around It
27
<hr>
<hr />
Inserts Plain Line (Horizontal Rule) Across Page Emphasize Divisions & Transitions In Content
Style
style=background-color: #RRGGBB | colorname; style=color: #RRGGBB | colorname; style=height: number; t l h i ht b style=width: number;
28
Special Characters
&
Ampersand
©
Copyright
·
Bullet
®
Registered
™
Trademark
29
<a>
<a></a>
Used to Create Links to Other Resources Named Anchor
AKA Bookmark Used to Name Specific Locations within a Page id Attribute
Defines Destination
30
<a>
Attributes
accesskey=text
Character Used as Keyboard Shortcut to Activate Link
href=URL
Specifies Location of Linked Resource
Typically Another HTML File Can Also Specify Other Internet Resources
Files, E-mail, FTP
31
<a>
Attributes
name=text
Marks Specific Place Within an HTML Document AKA Named Anchor or Bookmark
rel=text
Indicates Relationship Between Documents
rel=stylesheet
Tells Browser that Linked Document is a Style Sheet
32
<a>
Attributes
title=text
Provides Supplemental Information Regarding a Link
Behaves Like a Tooltip Should be Less Than 60 Characters
33
<a>
Example <a href="http://www.mysite.com/">A link to a site.</a> < a href="#P5">A link to paragraph 5 in same document.</a> <p>Paragraph 1</p> <p>Paragraph 2</p> <p>Paragraph 3</p> <p>Paragraph 4</p> <p id=P5>Paragraph 5 content.</p>
Web Engineering (703512) 34
Paths
Path
Location of Document on Server
http://www.sti-innsbruck.at/about/team/details/federico-michelefacca/
35
Paths
Absolute
Exact Location on Server
Begins with a /
/student/index.htm
Relative
Location Relative to Current Document
Current Nothing
page.htm
Child Separated by /
images/background.gif
36
URL
http://www.sti-innsbruck.at/about/team/details.html
Communication Protocol
http://
Domain
www.sti-innsbruck.at
Path
/about/team/
Document
details.html
37
Protocols
USENET
Newsgroup <a href=news:newsgroup.name>Click Me</a> g p
38
Protocols
E-Mail
Mailto
<a href=mailto:federico.facca@sti2.at>Send Mail</a>
Other Options
mailto:federico.facca@sti2.at?cc=another@sti2.at &bcc=secret@cod.edu&subject=subscribe &b t@ d d & bj t b ib &body=Send me your newsletter right away
39
<table>
<table></table>
Structure to Control Page Layout Structure to Contain & Align Content
Attributes
border=#
Sets Thickness of Borders Displayed for Table Cells Attribute Set to 0 Will Make Borders Invisible Invisible
40
<table>
Attributes
cellpadding=#
Specifies Amount of Space Between Cell & Content in Cell
cellspacing=#
Specifies Amount of Space Between Cells
41
<table>
Attributes
height=# | %
Specifies Height of Table in Pixels or Percentage of Window
width=# | %
Specifies Width of Table in Pixels or Percentage of Window
42
<colgroup>
<colgroup></colgroup>
Defines Groups of Table Columns for Formatting Only Valid Inside <table>
Attributes
align=left | center | right | justify | char
Specifies Horizontal Alignment of Contents in Column Group
43
<colgroup>
Attributes
span=#
Specifies Number of Columns <colgroup> Should Span
width=# | %
Specifies Width of Each Column in <colgroup> 0* - Column Width Should be Minimum Width
44
<col>
<col />
Defines One or More Columns of Table for Formatting Only Valid Inside <table> or <colgroup>
Attributes
align=left | center | right | justify | char
Specifies Horizontal Alignment of Contents in Table Column
45
<col>
Attributes
span=#
Specifies Number of Columns the Column Should Span
width=# | %
Specifies Width of Column 0* - Column Width Should be Minimum Width
46
<tr></tr>
Defines a Row in a Table
<td></td>
Defines Table Data (a Cell) in a Row
Table Data Cells Must Only Appear Within Table Rows Closing Tag Must Appear on Same Line as Content
Otherwise Gapping May Occur
47
<td>
Attributes
colspan=#
Specifies How Many Columns the Cell Overlaps
rowspan=#
Specifies How Many Rows the Cell Overlaps
48
<th></th>
Specifies the Table Header for a Row
Identical to Table Data Cells Except:
Cells Contents are Bolded Cells Contents are Centered
<caption></caption>
Attaches a Caption to a Table
49
Example
50
History of CSS
52
CSS Basics
Style Rules
Determines Style Characteristics for an HTML Element Selector
Determines Element to Which Rule is Applied
Declaration
Details the Exact Property Values
Property
Q alit or Characteristic (e g Color) Quality (e.g.,
Value
Specification of Property (e.g., Blue)
Style Sheet y
Set of Style Rules
53
CSS Basics
54
Embedded
Applied To An Entire Document
Redefines All Occurrences of a Particular Element
Uses <style></style> in <head>
Linked
External File of Declarations Available to an Entire Site
ASCII File with an Extension of .css
55
Syntax
<t style=property:value1; property:value2;> <tag t l t l 1 t l 2 >
56
Embedded Style
Syntax
selector {declarations}
<style type= text/css > type=text/css> h1 {color:green; font-family:sans-serif;} b {color:yellow; background-color:green;} </style>
57
Linked Style
Syntax
58
Cascading
Determines Which Rules are Assigned to Elements Weight Assignment Based on Four Variables:
Use of the !Important Keyword Origin of the Rule Specificity of the Selector Order of the Rule in the Style Sheet
59
60
Cascading
61
Inheritance
Parent
Element that Contains Another Element
Child
Element within Another Element
Inheritance
CSS Rules Inherit from Parent to Child Elements
Based on Hierarchical Structure of Documents
62
Basic Selection
Type Selectors
Selector Determines Element to which Declaration is Applied Style Sheet Examples:
h2 {color: red;} p {font-size: 10 pt;}
63
Basic Selection
Grouping Selectors
Set the Same Declaration for Multiple Selectors
Syntax:
h1 {color: red;} { ;} h2 {color: red;} or h1, h2 {color: red;}
64
Basic Selection
Combining Declarations
Multiple Declarations May be Stated for Same Selector
Syntax:
p{ {color: blue;} ;} p {font-size: 12pt;} or p {color: blue; font-size: 12pt;}
65
Basic Selection
Descendant Selector
AKA Contextual Selectors Based on Hierarchical Structure of Elements in Document
Syntax:
b i {color: #336699; background-color: #000000;} Does Not Apply to i b
66
Advanced Selection
class Attribute Selector
Enables Application of Rule to Selected Element(s) Core Attribute that can be Applied to Any HTML Element
Syntax: <p class quote >Text in red with a 30 pixel margin</p> class=quote>Text
May be Restricted to a Specific Element Type h1.quote {color: red; margin: 30px;}
Web Engineering (703512) 68
Advanced Selection
<div></div>
Block Level Element Used to Contain Other HTML Elements Displayed Discretely from the Rest of the Document p y y
Paragraph Breaks Added Before and After <div> Contents
<span></span>
Inline Element Used to Contain Other HTML Elements Used within Text Blocks
69
Advanced Selection
Pseudo-Class Selectors
Select Elements Based on Characteristics Other Than Name Link Pseudo-Classes
:link
Allow Modification of Style Characteristics for Unvisited Links :link {color: green;}
:visited
Allow Modification of Style Characteristics for Visited Links :visited {color: green;}
70
Advanced Selection
Pseudo-Class Selectors
Dynamic Pseudo-Classes
Apply Styles to an Element Based on Users Actions :hover
A li St l Wh U Applies Style When User M Mouses O Over El Element t
:active
Applies Style When User Activates Element
:focus
Applies Style When Element is Accepting User Input
71
Advanced Selection
Pseudo-Elements Selectors
Modify Aspects of Document Not Classified by Elements :first-letter
Apply Style Rules to the First Letter of Any Block-level Element
Initial Capitals Drop Capitals
72
74
Advanced Selection
Child Selector
>
Apply Style Rules to Child Elements of Any Parent div > blockquote {font-weight: bold;}
75
Advanced Selection
First Child
:first-child
Apply Style Rules to the First Child Element of a Parent div > p:first-child {font-weight: bold;}
76
Advanced Selection
Adjacent Sibling
+
Apply Style Rules to
Elements that Share the Same Parent Are Adjacent in the Code
77
Relative Units
Enables Scalable Web Pages
Adapt to Different Display Types & Sizes Recommended Method for Web Page Design
78
79
Font Propertiess
Styles
style=font-family: fonts;
Allows Specification of Font Family Names Generic Font Families
Allows Greater Portability A All G t P t bilit Across Pl tf Platforms Serif Traditional Letter Form (e.g., Times) Sans-serif Block Letters, Have no Serifs (e.g., Arial) Monospace Fixed-width
Every Letter has Same Horizontal Width
Cursive Resembles Handwriting (Limited Support) Fantasy Primarily Decorative (Limited Support)
80
Font Properties
Styles
style=font-family: fonts;
Specific Font Families
Allows Specification of Particular Font-family
Garamond Impact Garamond,
81
Font Properties
Styles
style=font-family: fonts;
Specifying Font Substitution
Allows Specification of Alternate Fonts
Uses Comma Separated List
82
Font Properties
Styles
style=font-size: size | keyword | %;
Relative Keywords
Smaller | Larger Example
Parent Elements Size is Large Current Elements Size is Set to Larger Result is that the Current Font Size will be X-large
Percentage
Example
50%, 150%, 200%
Font Properties
Styles
style=font-style: normal | italic | oblique; style=font-variant: normal | small-caps; style=font-weight: normal | bold | bolder | lighter | #; y g g ;
# = 100 900 in Increments of 100 400 = Normal 700 = Bold
Font Properties
Font Shortcut
Allows Specification of Properties in a Single Statement Font-size & Font-family Required
Must be in Order
Example:
<p style= font: 18pt/24pt arial bold;> style=font: bold; >
86
style=letter-spacing: normal | #; #;
AKA Kerning
style=word-spacing: normal | #; #;
AKA Tracking
I li Inline
Contain Content within the Block-level Elements Do not Form New Blocks of Content
List-item
Creates Surrounding Container and List-item Inline Boxes
91
Box Model
92
border-color: value
height: # | %
Sets Vertical Height of a Containing Box
List Properties list-style-type: disc | circle | square | decimal | decimal-leading-zero lower-roman upper-roman decimal leading zero | lower roman | upper roman | lower-greek | lower alpha | lower-latin | upper-alpha | upper-latin | hebrew | armenian | georgian | cjkideographic | hiragana | katakana | hira-ganairoha | katakana-iroha | none
Default = disc Allows Customization of the List Marker
Syntax:
ul {list-style-type: circle;}
106
Syntax:
ul {list-style-image: url(paw.gif);} { y g (p g );}
108
Syntax:
ul {list-style-position: outside;}
109
110
z-index: auto | #
Specifies an Elements Stacking Level
113
Example
114
JAVASCPRIPT
Web Engineering (703512) 115
Language used to write programs that compute inputs t another language processor i t to th l
One language embedded in another
Embedded JavaScript computes HTML input to the browser Shell scripts compute commands executed by the shell
JavaScript History
Form validation Page embellishments and special effects Navigation systems Basic B i math calculations th l l ti Dynamic content manipulation Sample applications
Dashboard widgets in Mac OS X, Google Maps, Philips universal remotes, Writely word processor, hundreds of others others
<html> <p> </p> <script> var num1 num2 sum num1, num2, num1 = prompt("Enter first number") num2 = prompt("Enter second number") sum = parseInt(num1) + parseInt(num2) I t( 1) I t( 2) alert("Sum = " + sum) </script> </html>
<script type="text/JavaScript"> Mouse event causes page-defined page defined function function whichButton(event) { to be called if (event.button==1) { alert("You clicked the left mouse button!") } else { alert("You clicked the right mouse button!") }} </script> / i t <body onmousedown="whichButton(event)"> </body>
Some possibilities
createElement(elementName) createTextNode(text) appendChild(newChild) pp ( ) removeChild(node)
Language Basics
Objects
Functions
A Anonymous functions f ti
(function (x,y) {return x+y}) (2,3);
Web Engineering (703512)
Examples of Functions
Curried functions
function CurriedAdd(x) { return function(y){ return x+y} }; g = CurriedAdd(2); g(3)
Anonymous Functions
C Concurrency
JavaScript eval
slide 131
Eval, run-time type checking functions Support for pattern matching (reg. expressions) Can add methods to an object Can delete C d l t methods of an object th d f bj t
myobj.a = 5; myobj.b = 12; delete myobj.a;
Example
133
WRAP UP WRAP-UP
Web Engineering (703512) 134
Things to keep in mind (or summary) XHTML for content structure CSS for presentation JavaScript for client side logic
135
Bibliography
Mandatory reading
XHTML Specification
http://www.w3.org/TR/xhtml11/
CSS Specification
http://www.w3.org/TR/CSS2/
JavaScript reference
http://www.w3schools.com/jsref/default.asp
136
Validation Tools
XHTML
http://validator.w3.org/
CSS
http://jigsaw w3 org/css-validator/ http://jigsaw.w3.org/css validator/
137
Next Lecture
# 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Date 7th Oct 14h O t Oct 21st Oct 28th Oct 4th Nov 11th Nov 18th Nov 25th Nov 2nd Dec 9th Dec 6th Jan 13th Jan 20th Jan 27th Jan Title Web Engineering Introduction and Overview Collection Requirements f W b A li ti C ll ti R i t for Web Applications Web Application Modeling Developing Applications with WebML Web Application Architectures I Web Application Architectures II Testing and Usability on the Web Mid Term Exam Web Technologies I Web Technologies II Web Technologies III Web 2.0 Mash-ups Web Application Development Process/ Project Management for Web Applications Final Exam Lecturer F. M. Facca F. M Facca F M. F F. M. Facca F. M. Facca F. M F M. Facca F. M. Facca F. M. Facca F. M. Facca F. M. Facca F. M. Facca F. M. Facca F. Daniel (UNITN) F. M. Facca F. M. Facca
138
Questions?
139