Skip to content

Phone Width

You'll make your site work on a phone, with a viewport tag, fluid widths, readable text and links you can tap with a thumb.

About

More than half of all visits come from phones, so a site that only works on a laptop is half a site. This isn't about frameworks or breakpoints for every device ever made. It's a viewport tag, fluid widths, text you can read without zooming, and tap targets you can hit with a thumb. The last requirement has you watch someone else use it on their own phone, which is where you'll find the thing you missed.

At a glance

Per requirement
25 XP
Completion bonus
150 XP
Requirements
5
Takes
One weekend
Skill level
Beginner (done it a few times)
Cost
Free
Supplies
Nothing special
Where
At home
Other people
With other people
Locked for now
Earn two more Common badges in Web Building to open this one. Log in to see how far along you are.

Requirements

  1. 1
    Add the viewport meta tag to every page. Without <meta name="viewport" content="width=device-width, initial-scale=1"> in the head, phones render your page at 980px wide and shrink it down to fit, which is why the text looks tiny. Add it to every page. Take a screenshot of the head with the tag in it. Photo
  2. 2
    Remove every fixed pixel width. Search your CSS for width: and px, and replace fixed widths with max-width, percentages or ch units. Images get max-width: 100% and height: auto so they shrink with the screen. Take a screenshot of the diff. Photo
  3. 3
    Check it at 320px wide with no horizontal scroll. Open the device toolbar in dev tools and set the width to 320. If a horizontal scrollbar appears, something is still too wide, so find it and fix it. Take a screenshot at 320px with the full page visible. Photo
  4. 4
    Make every tap target at least 44px tall. That means the links in your nav, any buttons and every form field. Add padding until each one is at least 44px tall and has some space around it, then try tapping each one on your actual phone with your thumb. Take a photo of your thumb on the phone over the nav. Photo
  5. 5
    Watch someone use it on their own phone. Send the link to one person and sit next to them. Ask them to find your about page and tap one link, and don't help. The place their thumb hesitates is the first thing to fix. Film it over their shoulder, with their okay. Video