codegurukool.com · Free coding tutorials & online compiler

Home › CSS Tutorial › Backgrounds and borders

Backgrounds and borders

Decorate boxes with color, gradients and rounded corners.

Use background for colors and gradients, border-radius for curves and box-shadow for depth.

Example code

<style>
  .c{width:220px;padding:24px;color:#fff;border-radius:14px;
     background:linear-gradient(135deg,#2e86de,#8e44ad);
     box-shadow:0 6px 16px rgba(0,0,0,.3);border:3px dashed #fff}
</style>
<div class="c">A decorated box</div>

Run this code in the online editor

← Responsive designUnits and variables →