cuckcoding.pro
Menu

Debug mobile CSS overflow with an AI assistant

“It looks weird on my phone” gives an agent unlimited creative freedom. That is how one long branch name earns your website a complete redesign. Here is a reproducible case you can shrink to a single CSS declaration.

Before you start
A browser with developer tools, a text editor and a coding assistant. Save the sample as overflow.html and open it locally.
How you’ll know it works
The full branch name remains readable at 360px and the text fits inside its own box.

Reproduce a long unbroken string

overflow.html
<!doctype html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
  .ticket { max-width: 18rem; border: 1px solid; padding: 1rem; }
  .ref { font-family: monospace; }
</style>
<article class="ticket">
  <h1>Build log</h1>
  <p class="ref">feature/00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff</p>
</article>

Set the viewport to 360 CSS pixels in device mode. The card is narrow, but the branch name has a long segment without a convenient break. For a real report, record the browser, the width and the exact string that triggered it. A screenshot alone hides all three.

Measure the element before suggesting a fix

In the browser console, compare the paragraph’s content width with the width available to it.

Browser console
const ref = document.querySelector('.ref');
console.table({ available: ref.clientWidth, content: ref.scrollWidth });

If content is larger than available, you have evidence of overflow in that element. If the numbers match, check whether the chosen viewport or the text differs from the sample. Several unrelated layout bugs look identical in a screenshot.

Give the agent the evidence

Lend this prompt to your agent
The .ref paragraph overflows at 360px. Here are the actual string, HTML/CSS and measured available/content widths: [paste them]. Keep the entire value visible and selectable. Explain why it overflows, propose one targeted CSS change, and show how to verify it. Preserve scrolling elsewhere on the page.

For this case, allow a wrap inside the long token. Applying overflow-x: hidden to the whole page would conceal information and leave the underlying sizing problem in place.

CSS
.ref {
  font-family: monospace;
  overflow-wrap: anywhere;
}

Compare before and after

Use the sample below to compare the behavior. Then repeat the measurement in your own page. When the value wraps, content and available widths should match. Check at 360px and a wider desktop size, select the whole string, and copy it. The line break is visual; the copied branch name should still be one continuous value.

Try the CSS change
Build log

feature/00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff

If the live project still overflows, inspect the parent layout before applying more CSS. A grid track or flex item that cannot shrink is a different problem. The chair is only qualified to debug one thing at a time.

Official references