HTML & CSS Intro Course: Intro to CSS
Master CSS fundamentals for professional web styling
CSS stands for Cascading Style Sheets and controls the visual look of webpages, while HTML formats the content. CSS handles page layout, spacing, text styling, fonts, sizes, and responsive design across different screen sizes.
Core CSS Properties Covered
Font Size
Controls text size using pixel values. Default browser size is typically 16 pixels, but can be adjusted up or down for better readability.
Line Height
Adjusts spacing between lines of text, similar to leading in print design. Helps improve readability when font size is increased.
Color
Uses hex codes to change text colors. Hex codes are 3-6 character combinations representing red, green, and blue light values.
Basic CSS Implementation Process
Create Style Tag
Add a style tag to your HTML document where you will write your CSS rules
Target HTML Elements
Use element selectors like 'p' for paragraphs or 'h1' for headings to specify which elements to style
Add Properties
Inside curly braces, define CSS properties like font-size, color, and line-height with their values
Test and Adjust
Save your changes and refresh the browser to see the styling effects, then adjust values as needed
CSS vs Browser Defaults
| Feature | Browser Default | Custom CSS |
|---|---|---|
| Font Family | Times Roman | Arial, Helvetica, sans-serif |
| Font Size | 16 pixels | Customizable (6-50+ pixels) |
| Text Color | Black | Any hex color code |
| Background | White | Customizable |
Hex codes work in base 16, representing RGB values from 0-255. The format is #RRGGBB where each pair controls red, green, and blue light intensity. Equal values create shades of gray, while different values create distinct colors.
Using System Fonts vs Custom Fonts
Font Size Guidelines
CSS Best Practices Checklist
Maintains visual hierarchy and improves readability
Prevents text from appearing cramped or too spread out
Ensures text remains readable for all users
Guarantees text displays even if preferred font is unavailable
Ensures consistent appearance and functionality
CSS basically controls the visual look of the webpage; HTML formats the content.
Key Takeaways