CSS Tutorial (original) (raw)

Last Updated : 12 Jun, 2025

CSS stands for **Cascading Style Sheets. It is a stylesheet language used to style and enhance website presentation. CSS is one of the three main components of a webpage, along with **HTML and **JavaScript.

CSS was released (in 1996), 3 years after HTML (in 1993). The main idea behind its use is that it allows the separation of content (HTML) from presentation (CSS). This makes websites easier to maintain and more flexible.

How to Add CSS to HTML?

There are three different ways to add CSS styles to an HTML document:

**1. Inline CSS

Use the style attribute on the HTML element to add styles to the web page. It is used for small projects.

HTML `

Welcome To GFG

<p>CSS Tutorial - GeeksforGeeks</p>

`

**2. Internal CSS

Place the CSS styles within a

Welcome To GFG

<p>CSS Tutorial - GeeksforGeeks</p>

`

3. External CSS

Create a separate CSS file with a ****.css extension** and link this file to your HTML file using the tag in header section. It consider the best practice to add CSS into HTML File.

HTML `

CSS Tutorial - GeeksforGeeks

CSS

/* Write CSS Here // External CSS / / File name: style.css */ p { text-align: center; }

`

Adding Animations in CSS

CSS allows you to animate HTML elements using the @keyframes rule. Let’s see how you can create a simple animation for a

tag. Let's understand this with the help of example:

XML `