Mini lesson · English

How to make your website usable on phones

Use a ready broken page, ask a coding assistant for a focused phone-layout repair and check the same visitor tasks afterward.

Start the interactive lessonRead the lesson below

Who is this for?

People whose website is difficult to use on a phone. You can describe a visible problem and let a coding assistant edit the supplied files; CSS knowledge is not required.

Before you start

A browser and the supplied before/after gallery. A coding assistant can open and change the folder. Use a real phone if available, or a narrow browser view; no separate mobile app is needed. Worked answers are illustrative examples, not completed tests on your account. Replace their sample observations with your own results, or identify the step that is still blocked.

Estimated time: 20–32 min

Estimates for the supplied starter files with prerequisite accounts and tools ready. Setup, deployment queues and delivery/DNS waits take additional time. Estimates cover one small page. Test on a real phone when available; device emulation does not reproduce every device condition.

What you will learn

  • Find a concrete phone-use problem.
  • Request a focused repair without losing content.
  • Retest links, enlarged text and wide views.

Workshop files

Step 1

Try the page as a phone visitor

Begin with the task, not a list of CSS rules.

Open before/index.html at a phone-sized width near 390 pixels. Try finding a project and reaching Contact. Keep a wide view for comparison and note the first thing you cannot read or activate comfortably.

Observe whether you need sideways scrolling or whether a link lies outside the screen. Do not assume that a smaller-looking page is usable.

A concrete example

The supplied before page has a wide two-card layout. On a narrow view, try finding A community garden diary, then Contact. “The second card is beyond the right edge at this width” describes a testable problem.

Open before/index.html and inspect the supplied gallery. Repair phone overflow while keeping both projects and Contact. Keep the desktop usable. Do not hide content just to remove scrolling. Explain the visible change and help me check 320px,390px,desktop,keyboard and enlarged text. I do not need a CSS lecture before trying the result.

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

How it works (optional)

Make your website usable on a phone

A mobile-friendly page lets a person complete a task without fighting the layout.

Our test task is to find a project and reach its contact route. We will check that task at narrow widths instead of judging only whether the page looks smaller.

Open before/index.html and set the browser viewport near 390 pixels. The supplied page intentionally uses a fixed-width layout, so it extends beyond the screen. Keep a desktop view as a comparison.

Worked example

If a visitor must drag sideways to reach a project link, the task is awkward even when every word technically exists on the page. Hiding the horizontal scrollbar would not repair the underlying layout.

Extra implementation exercise

The project link exists, but it is outside the phone screen and requires sideways scrolling. Has our task passed?

Show a worked solution

No. Find the element that exceeds the viewport and repair its sizing. Then repeat the project-to-contact task.

  • Evaluates whether the task is usable, not merely whether the link exists.
  • Identifies overflow as something to inspect rather than hide.

Step 2

Ask for one visible repair

Let the assistant identify the layout rule behind the symptom.

Give the assistant the supplied folder and a screenshot or precise description. Ask it to keep both project cards and Contact while removing the phone overflow. It can inspect and change the code for you.

Reload at the same width and repeat the failed action. Hiding a project or cutting off its text is not a successful repair.

A concrete example

Before: the garden card is off to the right. Request: keep both cards and make them readable here. After: repeat the search for the garden card; a prettier first card alone does not answer the original problem.

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

How it works (optional)

Find the element that is too wide

Measure the page and inspect its largest fixed-width elements before changing everything.

In developer tools, inspect main and the project grid. The starter gives main a width of 1100 pixels and each grid column a width of 500 pixels. Neither adapts to a 390-pixel screen.

The viewport meta tag is already present. Adding it again will not remove fixed widths. Compare the offending element’s box with the available viewport and change the constraint that causes the mismatch.

After repairing main, inspect the grid itself: two 500px columns still need 1000px plus their gap. Use flexible columns such as repeat(2, minmax(0, 1fr)), then a one-column layout when two readable cards no longer fit. Test just above and below the point where the content breaks.

Worked example

This main rule sets a maximum while allowing the container to shrink to the available width. The border-box rule keeps padding inside its assigned width.

* { box-sizing: border-box; }
main {
  width: min(1100px, 100%);
  margin: auto;
  padding: 24px;
}

Extra implementation exercise

After fixing main, the two 500-pixel grid columns still overflow. Which rule remains responsible?

Show a worked solution

The grid still requires two fixed 500-pixel columns plus its gap. Make the columns flexible and switch to one column when the content needs it.

  • Identifies the fixed grid-column widths.
  • Avoids shrinking body text as a substitute for fixing the layout.

Step 3

Check a nearby width

A repair should work around the example size too.

Try a narrower and slightly wider view, with a long title. Ask for a further adjustment only where content becomes cramped or unreadable. You do not need to choose a magic breakpoint number yourself.

Confirm that cards and text remain readable and links stay reachable across the tested widths. Keep a wide-screen comparison as well.

A concrete example

A repair that works at 390 pixels can still fail at 320. Use the same long garden-project title at both widths, then confirm the wide page has not lost a card.

MDN: responsive design

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

How it works (optional)

Let content choose a comfortable layout

Flexible columns and a small-screen breakpoint keep cards readable without shrinking their text.

Use minmax(0,1fr) for flexible columns and a one-column rule at a suitable narrow width. The exact breakpoint is a content decision, not a universal phone width. Test your actual headings and links around it.

Keep the heading responsive with clamp and allow long text to wrap. A real project title or address can be longer than the sample, so check that content too. The worked solution provides a complete CSS file after you try your own repair.

A plain 1fr column still has an automatic minimum that can be influenced by long content. minmax(0,1fr) permits that column to shrink below that automatic minimum; wrapping and the one-column breakpoint then keep the content usable. This repairs the constraint rather than disguising it with overflow:hidden.

Worked example

A two-column gallery can become a single column while preserving the same content and navigation. The user does not need a different page for the phone.

.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
@media (max-width: 700px) {
  .projects { grid-template-columns: 1fr; }
}

MDN: responsive design

Extra implementation exercise

At 710 pixels, your cards are cramped even though the example breakpoint is 700. Must you keep 700?

Show a worked solution

No. Move the breakpoint to a width where your content remains comfortable. Check the layout just above and below that width, rather than copying a number without testing it.

  • Chooses the breakpoint from actual content needs.
  • Retests both sides of the changed breakpoint.

Step 4

Use the controls and larger text

Layout is only one part of phone usability.

Activate Projects and Contact, move through links with the keyboard and increase browser zoom or text size. If a menu relies on mouse hover, ask the assistant for a tap/keyboard-friendly route.

Check that focus is visible and the same essential actions remain available after text enlarges. Try a real phone when possible; label emulation honestly.

A concrete example

For a keyboard check, press Tab until Contact is outlined, then Enter. For a text check, enlarge browser text or zoom and find Contact again. These are concrete actions the learner can perform without choosing CSS rules.

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

How it works (optional)

Check interaction and enlarged text

A page can fit the screen and still be hard to use.

Activate the Projects and Contact links. Ensure that controls have comfortable spacing, their labels describe the action and keyboard focus remains visible. Do not rely on hover-only behavior for essential information.

Increase browser zoom or text size and repeat the task. Check narrow and wide layouts with real content. Emulation is useful, but a real phone can reveal differences in touch behavior, browser UI and text rendering.

Worked example

The worked solution adds padding around links and a visible focus outline. Those changes make the interaction easier to find and use; they do not replace testing the actual link destinations.

Extra implementation exercise

A menu appears only when a mouse hovers over a label. What would you change for phone use?

Show a worked solution

Provide a clear button or native disclosure that works by tap and keyboard. Test opening, following a link and closing it without requiring hover.

  • Provides a click/tap or native disclosure interaction.
  • Keeps keyboard access and visible focus.

Step 5

Hand over the repaired gallery

Finish with repeatable checks another person can understand.

Save the repaired files and repeat the same task at approximately 320, 390 and 1440 pixels. Compare your result with the complete reference only after your own attempt.

Keep all original project/contact content. Record one before/after problem and the interaction/text checks you actually performed.

A concrete example

A concise handoff names the original blocked action and how it behaves now. “Responsive fixed” gives another person no repeatable check.

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

How it works (optional)

Your assignment: repair and test the gallery

Submit the changed files and observations for the same visitor task at several widths.

Repair the before version without deleting either project or the contact section. Try widths near 320, 390 and 1440 pixels, then check enlarged text.

Record the original culprit and the rule that fixed it. If a device test reveals another problem, describe that observation separately instead of claiming all devices were covered.

Worked example

“The main container was 1100px; it now fits the viewport, and the project grid becomes one column” explains the fix. “Mobile looks good” does not explain what you verified.

The complete reference walkthrough is available in reference/assignment-walkthrough.txt. Compare its steps with your own result; fill the test record from observations in your own project.

Extra implementation exercise

Make the gallery usable on a phone and provide a short behavior test record.

Show a worked solution

Reproduce the broken starter at 390px. Its fixed main width and fixed grid columns are separate sources of overflow; repairing only one does not repair the other.

Compare the worked-solution CSS: main uses a bounded flexible width, cards use minmax(0,1fr), long text may wrap and the grid becomes one column when the content needs it. Keep readable font sizes rather than hiding overflow.

At 320px, 390px and desktop width, use Projects then Contact by keyboard or touch. Enlarge text, insert a long title and check that controls remain visible and usable. A screenshot without a scrollbar is insufficient if the contact action cannot be reached.

  • Content remains available without horizontal overflow at the tested widths.
  • Project and contact tasks work with readable text, usable controls and visible focus.

Was this lesson useful?

Leave a like, or share it with someone who could use it.

Continue learning

Explore the other lessons