Sams Teach Yourself HTML and CSS in 24 Hours (7th Edition)

Just so you understand your options in regard to applying CSS styles to your web pages, following are the three main approaches you have at your disposal:

  • External style sheet A collection of CSS style rules that is placed in a document of its own with a .css file extension, and then linked to web pages via the <link /> tag in the head of each page.

  • Internal style sheet A collection of CSS style rules that is placed in the head of a document via the <style> tag. These style rules apply only to the page in which they are placed.

  • Inline style rules One or more CSS style rules that are placed directly within a tag via the style attribute. These style rules apply only to the specific tag in which they are placed.

As you can see, there is plenty of flexibility when it comes to how you apply CSS style rules. I highly recommend using an external style sheet if you're building a site with multiple pages that need to maintain a similar look. An internal style sheet isn't a bad option for a single page where you want to organize and possibly reuse some common styles. And finally, inline style rules are handy anytime you need to quickly apply a unique style to an element on a page.

Категории