CSS rules consist of three main parts: a Selector that targets the HTML element(s) to style (e.g., p for paragraphs), a Property that specifies the style attribute to change (e.g., color), and a Value that provides the setting (e.g., red). The format is: selector { property: value; }. Remember to end each declaration with a semicolon (;) and enclose declarations in curly braces {}. Common Pitfall: Missing semicolons can cause subsequent rules to fail. Always validate your CSS using tools like the W3C CSS Validator. Three Ways to Apply CSS CSS can be applied in three ways: Inline CSS — Applied directly in the HTML tag using the style attribute. Quick but not reusable. Use case: one-off styles or email templates where external files may not load. Drawback: Hard to maintain as styles are…
Key Takeaways
CSS rule = selector + property + value.
Inline CSS: quick but not reusable (style attribute).
Internal CSS: in <style> tag, good for single pages.