Tsallaka zuwa abun ciki
Justice Tech School

HTML and CSS

Inline styles use the style attribute on one element. Internal styles go in a style element in the head. External styles live in a .css file linked with a link element.

External CSS is best for real sites because one file styles every page. Inline styles are handy for quick tests, but they are hard to maintain.

Example
<style>
  h1 { color: darkgreen; }
  .note { background: #fef9c3; padding: 8px; }
</style>
<h1>Internal style</h1>
<p class="note">A styled note</p>
<p style="font-style: italic">Inline style</p>

Linking an external file

Example
<link rel="stylesheet" href="styles.css">

Exercise

Add an internal style sheet.

<>
  p { color: red; }
</>

Quiz Test

Which way to add CSS is best for a large website?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.