Explain inline, internal(embedded) and external stylesheet with example.

SOLUTION....

1. Inline Stylesheet

  • In inline CSS, styles are written directly inside the HTML tag using the style attribute.

  • It affects only that specific element.

  • Useful for quick styling but not recommended for large projects because it reduces readability and reusability.

Example:

2. Internal (Embedded) Stylesheet

  • In internal CSS, styles are written inside the <style> tag within the <head> section of the HTML file.

  • It applies to the whole page but only works within that particular HTML document.

  • Good for single-page projects where you want consistent styling.

Example:

3. External Stylesheet

  • In external CSS, styles are written in a separate .css file.

  • The HTML file links this stylesheet using the <link> tag inside the <head>.

  • This is the most recommended method because it allows code reusability, easier maintenance, and consistency across multiple pages.

Leave a Reply

Your email address will not be published. Required fields are marked *

sign up!

We’ll send you the hottest deals straight to your inbox so you’re always in on the best-kept software secrets.