Cascading Style Sheets, or CSS, was a language introduced to the Web in the mid 90s for the purpose of separating a webpage's "form" or "presentation" from it's "structure" or "content". Initially it handled things like layout, color changes and typography, but today in the era of CSS3, it has evolved to become a much more expressive language capable of creating interactive effects and animations.
Table of Contents:
CSS Rules
You can apply a set of CSS delcarations to multiple elements at once using CSS rules. A CSS "rule" contains two parts, a selector which specifies which element(s) the rules will be applied to and a declaration block, surrounded by {
curly brackets }
, which specifies how the element should be styled.
The declaration is split in two parts, the property which indicates the aspect of the element you want to change (ex: color, font, width, border) followed by a :
(colon) and then the value (the setting you want to use for that specific property) followed by a ;
(semi-colon). Check out MDN's Common CSS Properties Reference or CSS Trick's CSS Almanac for a more exhaustive list of CSS properties.
Including CSS to your page
There are a few ways you can add CSS code to your HTML page, one way is to create a <style>
element, which is an element that takes CSS code as it's contents.