Lesson 5 ยท Make a phone app

What's inside an app?

Learn how apps are built from screens and taps, then design a phone screen.

About 15 minutes

Tab indents. Press Escape, then Tab, to leave the editor.

You probably use apps every day: games, drawing apps, video calls, maybe a weather app. ๐Ÿ“ฑ But what's inside one? In this lesson you'll find out how apps are put together, and then you'll design a phone screen of your own.

An app is a set of screens

An app is a program you use on a phone, tablet or computer. Most apps are made of screens. A screen is one whole page of the app that fills the phone.

Think of a picture book. ๐Ÿ“– Each page shows something different, and you turn the pages to move through the story. An app works the same way. A game might have a start screen, a playing screen and a "You win!" screen. ๐Ÿ† Tapping a button takes you from one screen to the next.

The parts of a screen

Most app screens have the same few parts:

  • ๐Ÿ” A top bar that shows the name of the app or the screen.
  • ๐Ÿ–ผ๏ธ The content in the middle: pictures, words, the game itself.
  • ๐Ÿ‘† Buttons you tap to make things happen.

Next time you open an app, see if you can spot all three!

Taps are like clicks

On a computer you click with a mouse. On a phone you tap with your finger. To the app, a tap works a lot like a click. In fact, a web page on a phone hears a tap as a click, so the addEventListener('click', โ€ฆ) you learned last time works on phones too. ๐ŸŽ‰

Here's what happens in the tiny moment after you tap a button.

Step by step

What happens when you tap

Your finger touches the glass

The screen can feel your finger. It works out exactly where you touched, like a map pin. ๐Ÿ“

1 / 5

Big buttons for big fingers

A mouse pointer is tiny and exact. A finger is much bigger, and a bit wobbly. ๐Ÿ‘† If buttons are too small, you'll tap the wrong one by accident. That's frustrating!

So app makers make buttons big enough for a finger. Apple says buttons on an iPhone should be at least 44 points across, and Google says buttons on Android phones should be at least 48 of its own little units. Both work out to about the size of a fingertip. On a web page, you can think of that as at least 44 pixels.

Question

Quick check

Why should the buttons in a phone app be big?
Pick an answer.

How are real apps made?

The apps on your phone are written in programming languages. iPhone apps are often written in a language called Swift, and Android apps in a language called Kotlin.

But you can make app screens with the HTML, CSS and JavaScript you already know! Lots of apps are really web pages that work like apps. That's what we'll build. ๐Ÿ› ๏ธ

Design your phone screen

Here's a little "How do you feel?" app. It works, but its buttons are much too small for a finger, and it needs a name.

Challenge

Design your phone screen

  1. Change My App in the top bar to a name you choose. (HTML tab)
  2. Make the buttons big enough for a finger: at least 44 pixels tall. In the CSS tab, try a bigger font-size and more padding. (Padding is the space inside a button, around its words.)
  3. Add a third button with a feeling of your own. Give it its own id, then copy one of the addEventListener parts in the JS tab and change it for your new button.

Press Run and tap your buttons to try them!

Console
  1. Nothing logged yet.
  • Your top bar shows your app's name
  • Every button is at least 44 pixels tall
  • Your screen has a third button
  • Every button changes the screen when you tap it
Question

Quick check

Your web page app has a button with addEventListener('click', โ€ฆ). What happens when someone taps it on a phone?
Pick an answer.

What you learned

  • An app is made of screens, like the pages of a picture book.
  • Most screens have a top bar, content and buttons.
  • On a phone you tap instead of click, and a tap on a button counts as a click.
  • Buttons should be big enough for a finger: at least about 44 pixels.
  • You designed your very own phone screen! ๐Ÿ“ฑ

Finished this lesson?

Mark it complete to track your progress on this device.