What is the difference between inline, internal and external CSS?

There are three ways to add CSS to HTML.

TypeWhereBest for
Inlinestyle attribute on one elementQuick tests, one-off change
Internal<style> tag in the headOne page only
ExternalSeparate .css file linked with <link>Whole websites. Best choice
<!-- inline -->
<p style="color:red;">Text</p>

<!-- internal -->
<style>
  p { color: red; }
</style>

<!-- external -->
<link rel="stylesheet" href="style.css">

External CSS is the best for real sites, because one file styles all the pages and the browser keeps it in the cache. See HTML Styles.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.