A CSS editor is the program you type a stylesheet in. It saves plain text. A file named styles.css is the usual place. The browser reads that text and paints the page.
The colors you see while typing belong to the editor. A selector, a property, a value, and a comment each get a color so a long file is easier to scan. The browser never sees those colors. It sees the characters you saved.
The .css ending turns the coloring on.
Save the file as styles.css. In the HTML page, load it with <link rel="stylesheet" href="styles.css">. A preview reloads the page when you save.
Syntax
How the Editor Colors a Rule
One rule, four colors. The comment is dim. The selector, the property, and the value each have their own color:
CSS
/* a note the editor dims */p{color:#0f766e;}
Reference
What the Editor Is Showing You
The editor helps you read and fix the file. The browser only applies the text that is valid CSS.
In the editor
You see
The browser
File name
styles.css
Loads it from the link tag
Selector color
p
Matches every paragraph
Property color
color
Sets the text color
Value color
#0f766e
Paints teal
Comment color
/* note */
Skips the note
A warning
A line with no semicolon
Drops that declaration
Format
One property per line
Treats the spaces as whitespace
Three places you can edit the same file:
Editor
You open
Preview
Try It on this page
One HTML document
Press Run
A desktop code editor
index.html and styles.css
Reloads when you save
Any text editor
styles.css
Open the HTML file in a browser
Code
CSS Editor Examples
Four files you could type in an editor. View Output is what the browser paints. Try It Yourself is the editor: change the text and press Run.
Example 1 — The file the editor saves
This is styles.css. The rule is the whole job: the editor stores it, and the browser paints the paragraph teal.
#b45309 is the value. An editor swatch previews that hex beside the code.
color applies the same value to the paragraph, so the words are amber.
Edit the hex in Try It Yourself and press Run. The paragraph follows the new value.
Frequently Asked Questions
A CSS editor is the program you type a stylesheet in. It saves text, usually in a file named styles.css. The browser reads that text and paints the page. The colors in the editor are there for the person writing the file.
Any program that can save plain text can write CSS. A code editor adds CSS coloring, property completion, and a warning on a broken line. The Try It editor on this page is enough to practice. A desktop editor such as VS Code or Cursor fits a folder of HTML and CSS files.
Each piece of a rule gets its own color: the selector, the property, the value, and the comment. That makes a long file easier to scan. The browser ignores those colors and reads the characters.
The declaration runs on into the next property, so the value is no longer a valid color or length. The editor marks the line. The browser drops that declaration. Add the semicolon and the rule applies.
On this page, press Run in Try It Yourself. In a desktop editor, open the HTML file with a preview that reloads when you save styles.css. The preview shows the file the editor saved.