Example 1 — Fixed Pixel Width
Set an exact horizontal size with a length.
<style>
.box {
width: 200px;
}
</style>
<div class="box">200px wide</div> How It Works
- Pick a length.
200pxis a fixed distance on screen. - Apply to the box. The div becomes 200px wide (content area by default).
- Independent of parent. Parent size does not change this fixed value.
- Try
em.20emwould scale with the element’s font size.

