Here is Why ‘it works on My Machine’ Is a Communication Bug, not a Code Bug.
Tags: css, beginners, web dev, html Body : “It works on my machine.” 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. Here’s the bug and the fix, so you save 2 hours. The Code That Broke I used this CSS thinking it was enough: 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 yo
Comment
Sign in to join the discussion.
Loading comments…