Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Dynamic HTML and Cascading Style Sheets (CSS) Dynamic HTML and Cascading Style Sheets (CSS) Electronic Commerce Prof. Sheizaf Rafaeli.

Similar presentations


Presentation on theme: "1 Dynamic HTML and Cascading Style Sheets (CSS) Dynamic HTML and Cascading Style Sheets (CSS) Electronic Commerce Prof. Sheizaf Rafaeli."— Presentation transcript:

1 1 Dynamic HTML and Cascading Style Sheets (CSS) Dynamic HTML and Cascading Style Sheets (CSS) Electronic Commerce Prof. Sheizaf Rafaeli

2 2 Electronic Commerce; Prof. Sheizaf Rafaeli The BIG issues n Separating structure from content and behavior n Download time n Upgrade time n Compatibility (across, forward and backward) n Keeping it simple, learning and debugging

3 3 Electronic Commerce; Prof. Sheizaf Rafaeli Dynamic HTML “ “ Call us crazy, but we thought that the next big thing in HTML wasn't going to be a new tag. “ n Netscape’s (DevEdge) guide to DHTML: –http://developer.netscape.com/library/documentation/co mmunicator/dynhtml/index.htm n Microsoft’s Dynamic HTML Object Model: –http://msdn.microsoft.com/msdn- online/workshop/author/dom/domoverview.asp –http://msdn.microsoft.com/workshop/author/om/doc_ob ject.asp

4 4 Electronic Commerce; Prof. Sheizaf Rafaeli DHTML: Dynamic HTML n DHTML - still more a promise than a reality n But certainly the shape of things to come n n a group of technologies that make Web pages more like miniature software applications. n n If ever there was a Bleeding Edge

5 5 Electronic Commerce; Prof. Sheizaf Rafaeli Dynamic HTML n Cross-Browser techniques are the holy grail n WebMonkey’s tutorial, Nadav Savio, reconciles the two at: –http://www.hotwired.com/webmonkey/html/97/31/index2a.html n See C-Net builder’s tutorial at: –http://www.cnet.com/Content/Builder/Authoring/Dhtml/?st.cn.fd.acol.bl n See http://www.insidedhtml.com (book and website) –And especially the 10K demos!

6 6 Electronic Commerce; Prof. Sheizaf Rafaeli DHTML components n DOM: the (DYNAMIC) Document Object Model n CSS: Cascading Style Sheets n Scripting languages: (like Javascript, Active-X, asp). n And, depending on the browser, positioning, downloading fonts, streaming content, “behaviors”, image transition, animated backgrounds, etc.

7 7 Electronic Commerce; Prof. Sheizaf Rafaeli DOM: The Document object Model n n defines all items on a Web page as objects that can be manipulated. n n Otherwise, those elements are set, defined solely by the browser. For example, the DOM makes it possible to identify individual letters on a page as separate objects, and then to assign specific qualities, such as color or size, to each letter. In a sense, every letter becomes a tiny Web page.

8 8 Electronic Commerce; Prof. Sheizaf Rafaeli Cascading Style Sheets (CSS) n Cascading Style Sheets are a simple way to control style without compromising structure. They separate the style (visual design elements) from the structure of documents. n n CSS is a form of HTML mark-up that provides web designers with greater control over typography and spacing between elements on a page.

9 9 Electronic Commerce; Prof. Sheizaf Rafaeli Cascading Style Sheets (CSS) n Changing the style can affect an entire document. n Style sheets can be shared by multiple documents. n So changing a style can affect an entire website n n WHAT ABOUT BROWSER COMPATIBILITY? CSS support is provided in Internet Explorer 4+ and Netscape Navigator 4+. However, some annoying browser inconsistencies continue

10 10 Electronic Commerce; Prof. Sheizaf Rafaeli Cascading Style Sheets (CSS) n n CSS overrides the browser's default settings n n WHAT DOES CSS LOOK LIKE? – –The basic template for CSS code looks like this: – –Tag: {Property: value; Property2: value2} – –Tag - The element that will be affected Property - What part of the selector will be affected Value - How it will be affected

11 11 Electronic Commerce; Prof. Sheizaf Rafaeli Cascading Style Sheets (CSS) n n CSS overrides the browser's default settings n n A CSS declaration has two parts: – –a property (”font-size” or “color”) and a value ( “10pt” or "red"). n n The basic syntax of a rule – –selector {property 1: value 1; property 2: value: 2} n n Examples: – –P {font-size: 10pt; color: red} – –H1 {FONT-SIZE: 9pt; FONT-WEIGHT: bold}

12 12 Electronic Commerce; Prof. Sheizaf Rafaeli CSS (3) n Linked Global Local style sheet definitions. –definitions replace the definitions for typeface, font size, color and margins, etc. –Local (inline) definitions replace the definitions for typeface, font size, color and margins, etc. – declarations are defined within pairs, usually in header. –Global (embedded) declarations are defined within pairs, usually in header. –stylesheets use separate files, and link to them using : –Linked (external) stylesheets use separate.css files, and link to them using : » »

13 13 Electronic Commerce; Prof. Sheizaf Rafaeli Types of CSS n Inline: n Inline: this will be bold n n Embedded :

14 14 Electronic Commerce; Prof. Sheizaf Rafaeli Types of CSS n n External: n n The SHEET.CSS file would then contain all the style-sheet code which would be applied to any page that calls it using the code above.

15 15 Electronic Commerce; Prof. Sheizaf Rafaeli Short, sweet example n n REMOVE UNDERLINES - A Complete Style Sheet n n Do you want to remove underlines from links on your site? Below is a short and sweet style-sheet that will do just that, just copy and paste it between the tags on your site: – –

16 16 Electronic Commerce; Prof. Sheizaf Rafaeli Full CSS example <!-- h4 {font: 17pt Arial,Helvetica"; font-weight: bold; color: maroon} h2 {font: 15pt "Courier"; font-weight: bold; color: blue} p {font: 12pt "Arial,Helvetica"; color: black} -->... This is an example of the middle level (“global” or “embedded” form of CSS. Note how style code is hidden (as in Javascript) Note that fonts can be defined in points, pixels, inches or centimeters.

17 17 Electronic Commerce; Prof. Sheizaf Rafaeli CSS (4) n Cascading or Inheritance: When conflicting, the more specific stylesheet overrides. n Units of Measure: see: –http://www.hotwired.com/webmonkey/stylesheets/reference/units.html n Attributes: layers of Class, ID, Span and DIV. n Properties: see: –http://www.hotwired.com/webmonkey/stylesheets/reference/css_propert ies.html

18 18 Electronic Commerce; Prof. Sheizaf Rafaeli CSS (5) n W3C Cascading Style Sheets specs, at: –http://www.w3.org/TR/WD-CSS2/ n Microsoft’s User’s Guide, at: http://msdn.microsoft.com/workshop/author/css/css.asp http://msdn.microsoft.com/workshop/design/layout/css-des.asp n Examples, at: –http://www.hotwired.com/webmonkey/stylesheets/reference/examples.html –Microsoft’s CSS gallery, at: http://www.microsoft.com/truetype/

19 19 Electronic Commerce; Prof. Sheizaf Rafaeli CSS (6) http://www.htmlgoodies.com/beyond/classid.h tml http://www.htmlgoodies.com/beyond/classid.h tml http://www.w3.org/Style/css/ http://www.htmlhelp.com/reference/css/ http://www.canit.se/%7Egriffon/web/writing_st ylesheets.html http://www.canit.se/%7Egriffon/web/writing_st ylesheets.html http://builder.cnet.com/Authoring/CSS/ss02.ht ml http://builder.cnet.com/Authoring/CSS/ss02.ht ml


Download ppt "1 Dynamic HTML and Cascading Style Sheets (CSS) Dynamic HTML and Cascading Style Sheets (CSS) Electronic Commerce Prof. Sheizaf Rafaeli."

Similar presentations


Ads by Google