codegurukool.com · Free coding tutorials & online compiler

Home › CSS Tutorial › Colors and text

Colors and text

Control color, fonts and spacing of text.

Colors can be names, hex (#ff0), rgb() or hsl(). Set line-height around 1.5 for readable text.

Example code

<style>
  body { font-family: Georgia, serif; line-height: 1.6; }
  h1 { color: hsl(210, 80%, 45%); letter-spacing: 1px; }
  p { color: #444; text-align: justify; }
</style>
<h1>Styled heading</h1>
<p>Typography is most of what a web page is made of, so small changes here go a long way.</p>

Run this code in the online editor

← CSS installationThe box model →