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.

Mobile Web Design

A Web Design Lecture by Steven Choy

Overview: Markup for mobile web sites - Mobile Devices - Domain Names for mobile Web sites - Implement Mobile Stylesheets - Mobile META Tags - Case Studies - Tutorials


Markup for mobile web sites

  • WML
"In the early days of mobile web devices, the only way to surf the mobile web was to browse WAP (Wireless Application Protocol) sites. A WAP site uses WML (Wireless Markup Language) as its primary markup language. WML is an XML markup language based on the card-and-deck metaphor."
Here are the steps involved in serving WML content:
1 When a mobile phone submits a page request, it gets sent to the WAP Gateway that acts like a proxy;
2 The gateway fetches the WML page from the regular web server;
3 It then binary-encodes the content and passes the binary version of the page to the phone. The binary-encoding reduces the file size and makes the most of the limited bandwidth available to the phone; then
4 The gateway provides the phone company with the usage history of customers so they can be billed properly for their bandwidth usage.
How does WML look like?
        <?xml version="1.0"?>
        <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
        <wml>
          <card id="card1" title="Greeting">
            <p align="center">
              This is The first Wml Program!
            </p>
            <p align="center">
               From PerfectXML
            </p>
          </card>
        </wml>
  • XHTML-MP (XHTML Mobile Profile)
"The goal of XHTML Mobile Profile is to bring together the technologies for mobile Internet browsing and that for the World Wide Web. Before the coming out of XHTML Mobile Profile, WAP developers make use of WML and WMLScript to create WAP sites, while web developers use HTML / XHTML and CSS style sheets to build web sites."
"The difference between these two languages is that XHTML-MP consists of slightly fewer elements and tighter restrictions. These differences exist to make it easier for the mobile device to parse and render a web document, but writing XHTML-MP markup shouldn't introduce any significant changes to your process for writing regular XHTML."
  • XHTML
It is the same, basic XHTML rendered by desktop web browsers

Mobile Devices

  • Mobile screen size
    128 x 160 pixels
    176 x 220 pixels
    240 x 320 pixels
    320 x 480 pixels
  • Small Tablet: 460x640
  • Tablet - Portrait: 768x1024
  • Tablet - Landscape: 1024x768
  • Mobile Web Browsers
    Opera Mobile
    Key Features: Multiple tabs, Zoom-in
    Safari Mobile for the iPhone
    Key Features: Display rich websites like YouTube, zoom feature, excellent touch-based user interface
    Operating System: iPhone
    Android browser
    Key Features: Display rich websites, zoom feature, touch screen interface
    Operating System: Google Android

Domain Names for mobile Web site

  • Option A: Use a separate domain
Example: stepwise-mobile.hk
  • Option B: Use a subdomain
Example: m.stepwise.hk
Explore yourself: type the following in Google: site:m.*.hk
  • Option C: Use a .mobi top level domain
Example: stepwise.mobi
More information: http://mtld.mobi/

Serving Mobile Stylesheets

  • Server-side Methods & the UA String
    • Use a server-side language such as PHP to detect the user agent string with
    • The site detects mobile devices and either serves an appropriate stylesheet or redirects the user to a mobile subdomain
  • Client-side Methods & Media Queries
    • This technique uses the stylesheet’s media type to include mobile stylesheets
    • Examples:
      <link rel="stylesheet" href="site.css" media="screen" />
      <link rel="stylesheet" href="mobile.css" media="handheld" />

      <link media="only screen and (max-device-width: 480px)" 
        href="iphone.css" type="text/css" rel="stylesheet" />


      <link href="css/default.css" rel="stylesheet" type="text/css" media="screen, handheld" />  
  • User Initiated Method

Mobile META Tags

  • Mobile META tags can be used in XHTML-MP and HTML markup to tag the document as optimized for mobile devices.
  • Mobile search engines, mobile browsers and even desktop web browsers look for mobile META tags to identify and render mobile-optimized markup.
  • Viewport META Tag
The Viewport META tag controls the logical dimensions and scaling of the browser viewport window in many smartphone browsers.
      <meta name="viewport" 
      content="width=240, height=320,
      user-scalable=yes, initial-scale=2.5,
      maximum-scale=5.0, minimum-scale=1.0" />
  • Other examples:
      <meta name="viewport" content="width=240,user-scalable=no" />

      <meta name="viewport" content="width=320;" />

      <meta name="viewport" content="width=device-width; initial-scale=1.0;" />

      <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
  • Adding a Home Screen Icon
    • Example:
      <link rel="apple-touch-icon" href="/filename.png" />

Responsive Web Design

  • Idea: a website should respond to the device it's being viewed on.
    • Adapting the layout to suit different screen sizes, from widescreen desktops to tiny phones
    • Resizing images to suit the screen resolution
    • Serving up lower-bandwidth images to mobile devices
    • Simplifying page elements for mobile use
    • Hiding non-essential elements on smaller screens
    • Providing larger, finger-friendly links and buttons for mobile users, and
    • Detecting and responding to mobile features such as geolocation and device orientation.
  • To learn more: http://www.elated.com/articles/responsive-web-design-demystified/

Case Studies


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 06, 2012, at 05:47 PM