Interview Question

Difference between inline, internal, and external CSS?

Inline targets one element, internal stays in one document, and external CSS is reusable.

💡 Concept ✅ Quick Revision 🎨 CSS

Answer

Inline, internal, and external CSS differ by their location and reuse. β€’ Inline declarations are written in an element’s style attribute. β€’ Internal rules are written in a style element in the document. β€’ External rules are loaded from a separate style sheet with a link element.

💡 Simple Example

<link rel="stylesheet" href="site.css"> <style>.card { padding: 1rem; }</style> <div style="color: navy">Card</div>

⚡ Quick Revision

Inline targets one element, internal stays in one document, and external CSS is reusable.