From the course: CSS Fundamentals: Unlock the Power of Web Styling
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Organizing your code - CSS Tutorial
From the course: CSS Fundamentals: Unlock the Power of Web Styling
Organizing your code
- [Instructor] It's entirely possible to write valid, working CSS but have the actual code be a hot mess of confusion and inconsistency. I'd like to share some tips for keeping your CSS clean and well organized. My first piece of advice is to use comments liberally. Comments help other people understand your code, and frankly they help you understand your code if you've been away for a while and come back to it. Sometimes I'll look at old code that I've written and thank my past self for leaving my future self comments. Let's take a look at an example. So here we've got normalize CSS and if we look at the source code we can see that indeed, the author has commented things liberally. The comments are used to break code up into sections, and then within sections we've got descriptions of exactly what's happening. CSS comments can be single or multi-line. They just need to start with a forward slash asterisk and end with…