codegurukool.com · Free coding tutorials & online compiler

Home › HTML Tutorial › CSS in HTML

CSS in HTML

Three ways to add CSS.

Inline (style attribute), internal (a style element in the head) and external (a link to a .css file). External is best for whole sites.

Example code

<style>p{color:teal}</style>
<p>Internal CSS</p>
<p style='color:crimson'>Inline wins</p>
<!-- External: <link rel='stylesheet' href='style.css'> -->'

Run this code in the online editor

← HTML colorsHTML images →