A pixel, written as px in CSS, is a measurement unit for sizing web-page elements. You can use it for widths, font sizes, padding, and margins. section 4.4 section 6.4
Use pixel values to adjust the page’s appearance:
- Increase a font size by a pixel or two when text feels cramped. section 4.4
- Increase padding or margins when content feels crowded, or decrease margins when items seem disconnected. section 4.4
- Change a maximum width such as 800px to make the page wider or narrower. section 6.4
- Replace px measurements with rem when you want font sizes to respond to the browser’s default font size. section 4.4
A pixel-based page width
In CSS, max-width: 800px limits the page width, while padding: 25px adds space around its contents. Change the numbers to customize the result, but keep the px unit. section 6.4
body {
background-color: oldlace;
max-width: 800px;
margin: 0 auto;
padding: 25px;
line-height: 1.5;
}
Inspect a complete CSS rule using 800px for width and 25px for padding, alongside centered layout and line spacing. section 6.4









