Agyan
adda
Run
Reset
Copy
CSS Tutorial › CSS Units › Comparing units
Back to tutorial
Code
Edit, then press Run or Ctrl+Enter
<style> .px { font-size: 20px; } .rem { font-size: 1.5rem; } .half { width: 50%; background: #dbe8ff; padding: 8px; } .vw { width: 30vw; background: #ffe2d6; padding: 8px; margin-top: 8px; } </style> <p class="px">20px text</p> <p class="rem">1.5rem text (24px)</p> <div class="half">50% of parent width</div> <div class="vw">30vw of the window</div>
Result