Here at HubSpot we often recommend using your corporate blog to answer questions for your customers. Lately we’ve been taking our own advice and using the HubSpot Inbound Marketing Blog to address questions that people ask when they call in to HubSpot’s Sales and Service representatives.
Today’s question: What is CSS?
This is one we get a lot. It’s one of those things where a lot of people have heard the initials but most don’t know what they stand for. Out of the 7 billion people on the planet, we’re guessing that 6.999 billion don’t know what CSS is.
Once you do know what CSS is, you may discover that you actually don’t need to know what it is, because you’ll never have to deal with it -- you have designers or agencies that are handling your CSS needs. But we get it. You’re curious. Knowledge is power. And it's good to be well versed in the language your designers and agencies use. So here goes.
What is CSS?
CSS stands for Cascading Style Sheets. Basically, CSS is a language that manages the design and presentation of web pages -- the way things look. It works together with HTML, or HyperText Markup Language, which handles the content of web pages.
With CSS you can create rules to tell your website how you want it to display information. And you can keep the commands for the style stuff -- fonts, colors, and so on -- separate from the commands for the content.
They’re called “cascading” because you can have multiple style sheets, with one style sheet inheriting properties (or “cascading”) from others.
For a lot of people a plain old blog template is good enough. It’s only when you want to start customizing the look of a site that you need to delve into CSS.
Three Style Sheets
There are three kinds of CSS style sheets: external, internal, and inline.
External styles control how things look across many pages on a website.
Internal styles control the look of just one page.
Inline styles control just one element of a single page, even just a single word.
For more info on how these style sheets work together or “cascade” into one another, see this great tutorial from HubSpot.
Put simply, you can use multiple style sheets, and they will know how to defer to one another. Basically, inline overrides internal, and internal overrides external.
According to this CSS tutorial, you’re better off relying mostly on external styles, and avoiding the one-off stuff as much as possible.
You write out CSS commands and create a style sheet using a text editor. Then you link that style sheet to your HTML, and, voila, your site will now obey the rules you’ve set forth in the CSS style sheet.
There’s a lot more to CSS than what can be covered in a blog post. For example, as with any language, there’s a syntax that you have to learn, and we can’t cover that here. But if you're itching to get started ...
Just Enough to Be Dangerous
CSS code looks kind of weird at first glance. To give you an idea what it looks like, we've cribbed an example from a Mashable article on CSS. Take a look:
Translation: an unvisited link will appear in red, and a link that's been visited will be purple.
But it's not as techie as it seems. And again, a lot of people don’t ever need to touch CSS. However, if you do want to do some customization, you’ll need to come up to speed on CSS. If so, your best bet is to buy a book like this one to get caught up to speed, and then -- just start hacking away. The more you practice, the better and more fluent you'll be.
Image credit: Stefan Baudy