Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Customizing the user interface

From: Mobile Web Design & Development Fundamentals

Video: Customizing the user interface

In addition to creating full-screen apps, some browsers provide finer control over some of their user interface behavior. For example, you can turn on and off the detection of data in a page, like phone numbers. You can customize how links are highlighted when the user taps on them. You can change the browser's behavior when links are tapped and held. And you can even control how the user is allowed to select page content. So the way that you do this is by specifying certain tags and settings inside the page's head section.

Customizing the user interface

In addition to creating full-screen apps, some browsers provide finer control over some of their user interface behavior. For example, you can turn on and off the detection of data in a page, like phone numbers. You can customize how links are highlighted when the user taps on them. You can change the browser's behavior when links are tapped and held. And you can even control how the user is allowed to select page content. So the way that you do this is by specifying certain tags and settings inside the page's head section.

So for example, to turn off data detection, you simply specify a meta tag named format-detection and the content="telephone=no". This will prevent the browser, in this case the iPhone, from detecting phone numbers in your web pages and automatically putting links on them so that when the user taps on them, they can be dialed. If you don't want that behavior in your web app, you can turn it off. You can also control the color of link highlighting, simply by specifying a CSS style.

So for example, by specifying -webkit- tap-highlight-color, you can specify the color of links when they are tapped on. Again, if you're building a web app, especially a full-screen web app, this gives you the ability to make it look even more like a native, built-in application. You can also turn off the touch callout panel, and this is something that you usually want to do when you have a full-screen web application. So if you've ever been in the iPhone web browser and you touch on a link and you hold it, a little panel pops up from the bottom that gives you the opportunity to perform some additional actions on that link. And especially in the case of a full-screen web app, you want to turn that behavior off.

The way to do that is, once again, with a CSS style. You simply specify -webkit-touch-callout to be none, and that will turn that behavior off. If you want to turn it back on again, you just set it to inherit. You can control how the user can select text and other content in the page. So by setting the -webkit-user-select to none, the user can't select anything. You can also set it to text or auto for full selection. So in the example you see here, I've set the selection ability for all elements in the page to none except for elements that have the help class on them, because I might want the user to be able to select the text in something that I've labeled as help so they can copy it and paste it somewhere else, maybe in an email or a text message.

So let's see how all of this works in real code. So I am going to switch over to the code here. So here I am in Xcode, and this is our sample file. It's customui_start. And what we are going to do is test out some of these properties to customize how the browser responds to certain UI events. So down here you can see I've got some links, and they've got IDs on them. So this one is Tap and Hold, and this one says Tap on Me, and I've got some other stuff I am going to put in the page. So let's go up here, and I am going to go to my Snippets, and in my Snippets file, scroll down to the Customizing the User Interface section.

So I am just going to copy this, and I'll put this in the file, right up here in the head. So let's take a look at what is it that I've copied. So for elements with the ID of customHold, I've got the webkit-touch-callout set to none. For the customTap, I've got the tap highlight color set to red. And for the h1s in the page, I'm saying that the user cannot select the text in those. So let's scroll down. So here's the h1 right here. The user will not be able to select this text because of the select: none there. And then for customHold and customTap, which are right here, we should also see some special behavior.

So I am going to save this, and let's go to the Simulator. So before I actually load this up in the Simulator, let me show you the file as it currently is, and you can see that in the Tap on Me, I am getting this gray highlight color. And if I tap and hold on this link, you'll see that that little panel comes up, and I don't want that to happen. So when I refresh this in the browser, these links should have different behavior. You can also see that here I can copy text in the h1. I won't be able to do this when I have my new page loaded.

So let's go to the Finder, and I am going to copy my customui. I am going to paste it in over here. Now, I'll go back, and we'll refresh this page. Now you'll see a couple of things. First, when I tap on this link, see how the highlight color is red, whereas this one is gray. So I've customized the color there. You can also see that when I tap and hold on this link, I get the panel, but when I tap and hold on this link, I don't. So that behavior has now been turned off. And you notice that I can't select text in the h1 anymore.

Notice how the selection starts out down here in the paragraph, but I can't actually select the text up here. So just by specifying some attributes, some style sheets, and some other meta tags, I am able to have finer control over how the iPhone manipulates and responds to events in my web page, and when I am building things like full-screen web apps, this really comes in handy.

Show transcript

This video is part of

Image for Mobile Web Design & Development Fundamentals
Mobile Web Design & Development Fundamentals

46 video lessons · 25171 viewers

Joe Marini
Author

 
Expand all | Collapse all
  1. 2m 48s
    1. Welcome
      1m 2s
    2. Using the exercise files
      1m 46s
  2. 29m 25s
    1. Understanding the mobile context
      8m 5s
    2. A survey of mobile sites
      11m 44s
    3. Targeting mobile browsers
      4m 31s
    4. Previewing a complete mobile site
      5m 5s
  3. 27m 20s
    1. Designing for one web
      3m 43s
    2. Using well-defined web standards
      3m 45s
    3. Designing mobile-friendly pages
      3m 40s
    4. Being crisp, clean, and succinct
      5m 45s
    5. Minimizing input where possible
      6m 47s
    6. Focusing on the core scenarios
      3m 40s
  4. 1h 13m
    1. Installing the tools
      3m 52s
    2. Setting up a local web server
      9m 13s
    3. Installing device emulators
      17m 5s
    4. Using device emulators
      13m 9s
    5. Downloading Modernizr and Mobile Boilerplate
      6m 22s
    6. Building a first mobile web page
      5m 43s
    7. Developing mobile pages with desktop browsers
      8m 6s
    8. Exploring useful mobile web development resources
      10m 23s
  5. 53m 26s
    1. Reviewing mobile markup languages
      5m 10s
    2. Understanding content adaptation approaches
      10m 32s
    3. Controlling the viewport layout
      12m 50s
    4. Designing forms
      13m 30s
    5. Using CSS media queries
      11m 24s
  6. 1h 11m
    1. Detecting client capabilities with script
      10m 8s
    2. Caching information with local storage
      9m 16s
    3. Determining position with geolocation
      12m 52s
    4. Minimizing HTTP requests with data URLs
      7m 39s
    5. Understanding user agent detection
      9m 8s
    6. Using server-side detection with PHP
      6m 52s
    7. Using server-side detection with ASP.NET
      4m 54s
    8. Using HTML5 Boilerplate for mobile
      11m 6s
  7. 39m 22s
    1. Measuring performance
      7m 41s
    2. Creating full-screen web apps
      6m 30s
    3. Customizing the user interface
      5m 14s
    4. Detecting orientation changes
      3m 58s
    5. Detecting device movement
      5m 21s
    6. Using touch events
      10m 38s
  8. 47m 14s
    1. Taking a look at the finished site
      7m 40s
    2. Examining the header and background image style on the Home page
      10m 10s
    3. Examining the hover effect and layout styles on the Tours page
      6m 42s
    4. Examining mobile forms on the Contact page
      9m 45s
    5. Viewing and testing the mobile site on emulators
      8m 11s
    6. Viewing the site on devices
      4m 46s
  9. 2m 34s
    1. Goodbye
      2m 34s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Mobile Web Design & Development Fundamentals.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.