codegurukool.com · Free coding tutorials & online compiler

Home › CSS Tutorial › Height and width

Height and width

Set the size of elements.

Use width, height, min- and max- variants. Block elements default to full width.

Example code

<style>
div{width:50%;height:80px;background:#1b998b;color:#fff;min-width:150px}
</style>
<div>Half width</div>

Run this code in the online editor

← CSS paddingCSS outline →