<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Winfred</title>
    <description>The latest articles on DEV Community by Winfred (@coder-winnie-win).</description>
    <link>https://dev.to/coder-winnie-win</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3888907%2F9fa70100-3738-4ba3-b002-5161030298f8.jpg</url>
      <title>DEV Community: Winfred</title>
      <link>https://dev.to/coder-winnie-win</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/coder-winnie-win"/>
    <language>en</language>
    <item>
      <title>Here is Why ‘it works on My Machine’ Is a Communication Bug, not a Code Bug.</title>
      <dc:creator>Winfred</dc:creator>
      <pubDate>Mon, 20 Apr 2026 12:18:27 +0000</pubDate>
      <link>https://dev.to/coder-winnie-win/here-is-why-it-works-on-my-machine-is-a-communication-bug-not-a-code-bug-2jop</link>
      <guid>https://dev.to/coder-winnie-win/here-is-why-it-works-on-my-machine-is-a-communication-bug-not-a-code-bug-2jop</guid>
      <description>&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; css, beginners, web dev, html&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Body&lt;/strong&gt;:&lt;br&gt;
“It works on my machine.” &lt;/p&gt;

&lt;p&gt;That’s what I told my friend when I sent him my first website. On my laptop it was perfectly centered. On his phone? All text hugged the left side.&lt;/p&gt;

&lt;p&gt;Here’s the bug and the fix, so you save 2 hours.&lt;/p&gt;

&lt;p&gt;The Code That Broke&lt;br&gt;
I used this CSS thinking it was enough:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
css
body {
  margin: 40px auto; 
  text-align: center;
}
Result: Left-aligned. Why?

The Fix: margin: auto needs a width
margin: auto splits leftover horizontal space evenly. If your element is width: 100%, there’s zero leftover space. Nothing to split.

Fixed CSS:
body {
  width: 90%;           /* Creates leftover space */
  max-width: 600px;     /* Stops it getting too wide */
  margin: 40px auto;    /* Now it centers */
  text-align: center;
}
How I Explain It to Clients

A baking tray as wide as the oven can’t be centered. Shrink the chapati with width: 90%. Now margin: auto slides it to the middle.

other ways to fix the bug:

Flexbox for components:
.parent {
  display: flex;
  justify-content: center;
  align-items: center;
}
Grid for full pages — 1 line:
.parent {
  display: grid;
  place-items: center;
  min-height: 100vh;
}
Debug Checklist
In DevTools → Computed tab, check:
1. Is width: auto? Add width: 90% or 600px
2. Is it display: inline? Change to block
3. For vertical center: Does parent have height?

**Live demo of my page:**https://codepen.io/Coder-winnie-win/pen/pvEBpNG

What CSS bug stole hours from you? Drop it below 👇
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>beginners</category>
      <category>css</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
