CSS (Cascading Style Sheets) is a set of rules that contains elements of style for a web page such as colors, fonts, borders and sizes. Keeping style elements separate from HTML content has advantages like cleaner HTML code, faster page loads, and the ability to efficiently make changes across many pages at once. There are different types of CSS documents including external style sheets in separate files and internal style sheets within HTML files.
2. What CSS is, and isn’t A Cascading Style Sheet is a set of rules that contains the elements of style for a web page, such as background color, font type, borders, and sizes. “Cascading” means from the homepage on down through the rest of the site. HTML or XHTML code files have the the text/content that appears on a page. So, CSS has style, and HTML has substance.
3. Why CSS? Keeping style elements separate from text and content elements has several advantages: HTML code is cleaner, with fewer errors Code is faster to create (ex. a rule about heading style will apply to ALL headings) Changes can be made efficiently (ex. changing out company colors after a rebranding can be made in one place for all pages)
4. More benefits of CSS Web pages are more accessible for visitors with visual impairments Different CSS files can be linked to the same HTML file, so the same content can appear differently (mobile, print layout, different PC or Mac browsers, TV screens, etc…) Pages load faster, since the browser stores the site’s CSS from the first page visited, and just loads the HTML for each subsequent page
5. Types of CSS documents External Style Sheets are saved as a separate file, linked to from an HTML document. These are most versatile, and effective. Sometimes you may need to use an Internal Style Sheet within an HTML file to override a set of rules from an external CSS document.
7. Credits W3schools.com Intro to CSS World Wide Web Consortium (W3C), What is CSS? Ch. 9 of Beginning Web Programming with HTML, XHTML, and CSS, by Jon Duckett