DEV Community

Max Lockwood
Max Lockwood

Posted on • Originally published at maxlockwood.dev

What is CSS? Basics Explained

CSS stands for Cascading Style Sheets.

  • Cascading refers to the way CSS applies one style on top of another.
  • Style Sheets control the look and feel of web documents.

CSS and HTML work hand in hand:

  • HTML sorts out the page structure.
  • CSS defines how HTML elements are displayed.

To understand CSS, you should already have a basic knowledge of HTML.

CSS Syntax

CSS is a rule-based language, which means that you define the rules by specifying groups of styles to be applied to specific elements or groups of elements on your web page.

Here is an example of a simple CSS rule, that makes the main heading show as large red text and a font-size of 5rem. In CSS rem stands for “root em”, a unit of measurement that represents the font size of the root element.

h1 {
  color: red;
  font-size: 5rem;
}
Enter fullscreen mode Exit fullscreen mode

What are CSS style sheets used for?

CSS (Cascading Style Sheets) is used to style and layout web pages, such as changing the font, colour, size, and spacing of your content, splitting it into multiple columns, or adding animations and other decorative elements.

Why Use CSS?

CSS allows you to apply specific styles to specific HTML elements.

The main benefit of CSS is that it allows you to separate style from content.

Using just HTML, all the styles and formatting are in the same place, which becomes rather difficult to maintain as the page grows.

All formatting can (and should) be removed from the HTML document and stored in a separate CSS file.

Is CSS a programming language?

Cascading Style Sheets (CSS) is a stylesheet language that instructs the browser how we want our HTML to appear; it is not a programming language.

Conclusion

Let’s summarise what we’ve learned about CSS and how it helps with web page aesthetics:

  • CSS was designed to work in tandem with other markup languages such as HTML.
  • CSS (Cascading Style Sheets) is used to style and layout web pages.
  • CSS allows you to apply specific styles to specific HTML elements.

Now that you understand what CSS is, let’s go to CSS – Max Lockwood to learn some more concepts about CSS.

See also

What are the 3 Ways to Style in CSS?
What are CSS Rules and Selectors?
What are the Most Common CSS Units?

If you liked this article, then please share. You can also find me on Twitter for more updates.

Top comments (0)