Nearby lessons

3 of 19

🎨 CSS Types

πŸ“Œ What are CSS Types?

CSS can be applied in different ways to style your webpage. The three main types are:

  • 🧷 Inline CSS – Directly on HTML elements
  • πŸ“„ Internal CSS – Inside <style> tags in the HTML head
  • πŸ—‚οΈ External CSS – In a separate .css file

πŸ”Έ Inline CSS

Inline CSS is added inside the style attribute of an HTML tag. Best for quick, one-time styles.

Code Example
PREVIEW READY
Loading Editor...
Live Preview

πŸ“„ Internal CSS

Internal CSS is placed inside a <style> tag in the HTML document's head. Best for single-page designs.

Code Example
PREVIEW READY
Loading Editor...
Live Preview

πŸ—‚οΈ External CSS

External CSS is written in a separate .css file and linked with the <link> tag. Best for large projects.

Code Example
PREVIEW READY
Loading Editor...
Live Preview

βœ… Best Practices

  • πŸ”— Use External CSS for better reusability and clean structure.
  • 🚫 Avoid too much Inline CSS – hard to maintain.
  • πŸ“‘ Internal CSS is fine for small or temporary projects.
  • 🧹 Organize your CSS with comments and proper naming.

🧠 Test Your Knowledge

5 Questions

Progress: 0 / 5
Keep Going!CSS - Selectors