Skip to main content

What is CSS and what is it used for?

CSS (Cascading Style Sheets: cascading style sheets), is a language responsible for the appearance and styling of web pages. If HTML is the "skeleton" and structure of a page (headings, text, images, buttons), then CSS is the "clothes and makeup" that make a site attractive and easy to use.

What CSS is used for

CSS lets you:

  1. Customize the appearance of elements
  • colors, sizes, fonts, spacing, shadows, borders, and so on.
  1. Control the layout of blocks on a page
  • align elements, create columns, grids, and responsive layouts.
  1. Create responsive design
  • so the site looks good on a phone, tablet, and computer.
  1. Create animations and visual effects
  • smooth appearances, hover effects, button and transition animations.
  1. Separate logic from presentation
  • HTML is responsible for content, CSS for style, which makes the code clearer and easier to maintain.

Short analogy

TechnologyResponsible for
HTMLstructure and content
CSSappearance, style, presentation
JavaScriptbehavior and interactivity

Simple example

HTML:

html
<p>Hello, world!</p>

CSS:

css
p { color: red; font-size: 20px; }

This CSS will make the text red and larger.


Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.