What's the difference between inline, embedded, and external styles?
Author: Deron Eriksson
Description: This is a short CSS example demonstrating the difference between inline, embedded, and external styles.
Tutorial created using: Windows XP


Page: < 1 2

(Continued from page 1)

For convenience, here is an HTMLW document that contains all of the above code:

style-test.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Style Test</title>
<style type="text/css">
p#embeddedExample { 
	background: orange;
}
</style>
<link rel="stylesheet" type="text/css" href="external-styles.css" />
</head>
<body>
<p id="inlineExample" style="background: yellow">Inline style example</p>
<p id="embeddedExample">Embedded style example</p>
<p id="externalExample">External style example</p>
</body>
</html>

Here is the external stylesheet that this document references:

external-styles.css

p#externalExample {
	background: aqua;
}

Here is the displayed output of the style-test.html document:

display of style-test.html
Page: < 1 2