CSS, or Cascading Style Sheets, is a language used to describe the presentation or style of a document written in HTML (HyperText Markup Language). While HTML defines the structure and content of a webpage, CSS determines how HTML elements should be displayed on that page. This includes aspects such as layout, colours, fonts, and spacing.
The primary goal of CSS is to separate the structure of a webpage (HTML) from its style or presentation. This separation provides several key advantages:
CSS works by associating styling rules with HTML elements. These rules are typically defined in a separate CSS file or embedded directly within the HTML document. Here’s how CSS is applied to HTML:
The most common method is to link an external CSS file to your HTML document using the `<link>` tag in the `<head>` section: