From the course: CSS for Developers
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Organize your CSS - CSS Tutorial
From the course: CSS for Developers
Organize your CSS
- [Carrie] 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 you come back to it. Whenever I look at old code I've written and I find good comments, I thank past Carrie for making things easier to understand for present Carrie. As an example, here's normalize.css. And if we look at the source code, we can see that indeed the author has used comments liberally. The comments are used to break code up into sections. And then within sections, we've got descriptions of exactly what's happening below with those selectors. CSS comments can be single or multi-line. They just need to start with this /*, and end with the */. But the characters in between can be…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.