CSS How To

Applying CSS

  • Inline: using the style attribute directly on elements.
  • Internal: placing CSS inside a <style> tag within the HTML <head>.
  • External: linking to an external .css file using the <link> tag.

Linking CSS to HTML

Use the <link rel="stylesheet" href="styles.css" /> tag in the <head> section.

Alternatively, embed CSS using the <style> tag.

Best Practices

Use external stylesheets for maintainability and caching; internal for page-specific styles; inline for quick tests or overrides.