CSS stands for cascading style sheets, and that's very much what they are — files that contains a set of rules to control the presentation of an HTML document (i.e. a web page/). The cascade part means that when rules conflict, those that are read later (i.e. lower in the file/) take precedence over those read earlier.
The primary responsibility of CSS is to separate presentation from content. The content and structure of a web page is determined by HTML being sent from the web server to the browser that you're using, while CSS controls how that content appears on the page.
For example, in that previous paragraph, the HTML looks something like this:
<p>
The primary responsibility of CSS is to separate presentation from content.
The structure and content of a web page is determined by HTML being sent from
the web server to the browser that you're using, while CSS controls how that
content <em>appears</em> on the page.
</p>
That doesn't tell the browser how to render the content, beyond the reasonable defaults it may have in place for paragraph (<p>
) and emphasis (<em>
) elements.
But when my web server sent your browser that bit of HTML, it also told it to include some CSS alongside it. And the CSS is what is responsible for determining presentation, like:
- Font
- Text size and spacing
- Text color
- Spacing around the paragraph
Since there are so many resources on CSS out there, that's where I'll stop this intro. If you want to dig in further on CSS, I'd suggest starting with a free course, like this one from Codeacademy or this video on HTML and CSS from freeCodeCamp.