Menu

1 / 4

Stop Letting Your Website Stretch Across the Whole Screen (Fix It in 1 Line of CSS)

JavaScript in Plain English - Medium·Er Raj Aryan·1 day ago
#RsW64juN
Reading 0:00
15s threshold

Member-only story

Stop Letting Your Website Stretch Across the Whole Screen (Fix It in 1 Line of CSS)

Er Raj Aryan

3 min read20 hours ago

Press enter or click to view image in full size

Two tiny W3.CSS classes that make your layout look instantly more professional.

Open your website on a 27-inch monitor.

Do the lines of text run from one edge of the screen to the other? Do the images look huge? Is everything spread so far apart that your eyes have to travel across the room?

If so, you have a page width problem . Beginners hit it all the time, and it’s one of the easiest things to fix.

Why a full-width page hurts

A page that fills a very wide screen is hard to read:

Lines of text become too long

Images grow far bigger than intended

Page elements drift too far apart

The fix is to limit the page width and center it , leaving breathing room on both sides.

Fix #1: w3-content (the one-liner)

Add one class to your <body> :

<body class="w3-content">

<header class="w3-container w3-blue">

<h1>My…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.