Recent Changes - Search:

Web Design

This website demonstrates using wikis as teaching and learning tool.

The course instructor is happy to share the teaching materials here with those who find it readable.

Some New Developments in Web Design

A Web Design Lecture by Steven Choy

Overview: HTML5 - CSS3 - AJAX - Social Networking


HTML5

Introduction

  • HTML5 is the next major version of HTML. The current versions of HTML include HTML4, XHTML 1.0 and XHTML 1.1. HTML5 is supposed to be a replacement for all of the older versions of HTML. Almost all modern browsers on the Desktop PC support HTML5.
  • HTML5 provides a number of new elements and attributes that reflect typical usage on modern Web sites. It introduces some new elements that will make Web pages more semantic. It also includes new APIs for drawing graphics on screen, storing data offline, dragging and dropping, and a lot more.

New semantic elements

  • HTML5 introduces a number of additions to the semantic elements.
    • For example, <header>, <nav>, <aside>, and <footer> are introduced to be the semantic replacements for common uses of generic block (<div>).
    • They are meant for marking up the header, navigation, sidebar and footer.
    • Two new elements, namely, <section> and <article>, are introduced to mark up a generic section of a document and an article respectively.
(Figure: Some New Semantic Elements in HTML5)
A showcase of sites using HTML5 markup: http://html5gallery.com/

New input types

  • HTML5 introduces some new input types that are ready to use in Web forms.
  • The following lists the most common input types in conventional web forms.
  • In addition to that, HTML5 adds a number of new input types such as email address, web address, number, range, color, date, and time.
  • The benefit of such an enhancement to web forms is that you longer have to do client-side validation of emails, date, etc. The browser takes care of this for you.
Example code:
      <form action="#" method="post">
          <h3>Post a comment</h3>
          <p>
              <label for="name">Name</label>
              <input name="name" id="name" type="text" required />
          </p>
          <p>
              <label for="email">E-mail</label>
              <input name="email" id="email" type="email" required />
           </p>
           <p>
               <label for="website">Website</label>
               <input name="website" id="website" type="url" />
           </p>
           <p>
               <label for="comment">Comment</label>
               <textarea name="comment" id="comment" required></textarea>
           </p>
           <p><input type="submit" value="Post comment" /></p>
      </form>

Drawing and media

  • HTML5 introduces a new tag <canvas> which is for immediate mode 2D drawing.
  • It is a pixel-based drawing surface that you can create image with JavaScript.
<canvas> is a new HTML element which can be used to draw graphics using scripting (usually JavaScript).
Example: <canvas id="a" width="300" height="225"></canvas>
You can then find that <canvas> element in the DOM: var a_canvas = document.getElementById("a");
  • Moreover, embedding audio and video in web page is now built in supported via <audio> and <video> elements.
The audio and video will now be built in supported via <audio> and <video> elements.

New Development APIs

  • HTML5 introduces new APIs, such as offline storage database, drag-and-drop, document editing, to help the development of RIA (rich internet application).

CSS3

  • Backgrounds and Borders
    • There are some new attributes, such as border-color, border-image, border-radius, box-shadow, that allow you to play with backgrounds and borders of any box in new ways.
  • Multi-column Layout
It lets you display your content in multiple columns with less code.
  • Grid Positioning
allow you to create grid layouts easily

AJAX

  • AJAX stands for Asynchronous Javascript and XML
  • Ajax is a way of developing Web applications that combines:
    XHTML and CSS standards based presentation
    Interaction with the page through the DOM
    Data interchange with XML and XSLT
    Asynchronous data retrieval with XMLHttpRequest
    JavaScript to tie it all together
  • In the traditional Web application, the interaction between the customer and the server goes like this:
    1. Customer accesses Web application
    2. Server processes request and sends data to the browser while the customer waits
    3. Customer clicks on a link or interacts with the application
    4. Server processes request and sends data back to the browser while the customer waits
    5. etc....
  • Rather than waiting for an entire web page to be downloaded (including all of the images, CSS and JavaScript), AJAX just downloads small pieces of information and then use JavaScript to dynamically update the web page.
  • This makes for a much quicker and generally more user-friendly experience.
1. The user generates an event, such as by clicking a button. This results in a JavaScript call.
2. An XMLHttpRequest object is created and configured with a request parameter that includes the ID of the component that generated the event and any value that the user might have entered.
3. The XMLHttpRequest object makes an asynchronous request to the web server. An object (such as a servlet or listener) receives the request, processes it, and stores any data in the request to the data store. In the case of Ajax-aware JavaServer Faces components, the object that processes the request is a PhaseListener object. We'll cover that more later in the document.
4. The object that processed the request returns an XML document containing any updates that need to go to the client.
5. The XMLHttpRequest object receives the XML data, processes it, and updates the HTML DOM representing the page with the new data.

Social Networking

  • Facebook Comments Plugin: Add social comment in your web site
Comments Box is a social plugin that enables user commenting on your site. Features include moderation tools and distribution.
You just need to add the following code in your web page:
      <div id="fb-root"></div>
      <script src="http://connect.facebook.net/en_US/all.js#appId=YOUR_APP_ID
      &amp;xfbml=1"></script>
      <fb:comments xid="POST_ID" numposts="10" width="425" publish_feed="true"></fb:comments>
  • Google Friend Connect: Google Friend Connect lets you easily add robust, social features to your website.
  • AddThis: Add social networking buttons on your website.

References and Resources


Thanks for Reading

If you would rather like to have this lecture note in printed format, please click the print action link in the top right corner.

If you find any problem in this lecture note, please feel free to tell Steven via steven [at] findaway.hk.

Edit - History - Print - Recent Changes - Search
Page last modified on March 04, 2011, at 09:51 AM