CSS BasicsCore· 30 min read

What is CSS?

You can build a page with HTML — but it looks plain. CSS is what makes the web beautiful.

What you will learn

  • Explain what CSS is and why it exists
  • Describe how CSS works with HTML
  • See the dramatic difference styling makes

CSS = the style layer

CSS stands for Cascading Style Sheets. If HTML is the structure (walls and rooms), CSS is the decoration (paint, furniture, layout). It controls colours, fonts, spacing, size and position — everything about how a page looks.

Note: One HTML page, two looks. The HTML below is identical in both — only the CSS changes. That is the superpower: separate content from appearance.

Plain HTML

First, here is a tiny page with no CSS at all — just three plain HTML tags. This is what every web page looks like before you style it:

No CSS — functional but plain
<h1>CodingClave</h1>
<p>Learn web development the right way.</p>
<button>Join now</button>
Live preview

Read the code above. It is just three HTML tags: a heading, a paragraph and a button. The browser shows them, but everything is the default look — black text, plain font, a grey system button. There is no colour, no spacing, no personality. That is HTML on its own.

The same HTML, now with CSS

Now watch what happens when we add a <style> block on top of the exact same three tags. Do not worry about understanding every line yet — just notice how different it looks. We will explain each rule right after:

Same content — transformed by CSS
<style>
  body { font-family: sans-serif; background: #eef2ff; text-align: center; padding: 30px; }
  h1   { color: #4338ca; font-size: 40px; }
  p    { color: #5b6178; font-size: 18px; }
  button {
    background: #06b6d4; color: white; border: none;
    padding: 12px 24px; border-radius: 10px; font-size: 16px; cursor: pointer;
  }
</style>

<h1>CodingClave</h1>
<p>Learn web development the right way.</p>
<button>Join now</button>
Live preview

Look closely: the bottom three lines (the <h1>, <p> and <button>) are exactly the same as before. Only the <style> block at the top is new. Here is what each rule inside it does:

  • body { ... } — sets a nice sans-serif font, a soft blue page background, centres everything and adds breathing room (padding).
  • h1 { ... } — paints the heading indigo and makes it large (font-size: 40px).
  • p { ... } — gives the paragraph a softer grey colour and a comfortable size.
  • button { ... } — turns the plain grey button into a cyan, rounded, white-text button with a hand cursor.

Note: Same words, completely different feel. That is the whole point of CSS: you write the content once in HTML, then the <style> block decides how it looks. Change a single colour in the style block and the page changes — the HTML never moves.

Tip: CSS is the second of the three web languages. You already know HTML; once you add CSS you can build any look you can imagine. JavaScript (behaviour) comes after.

Q. What does CSS control?

Answer: CSS controls appearance — colours, fonts, spacing, size and layout. HTML provides the structure; JavaScript adds behaviour.

✍️ Practice

  1. Take any HTML page you built in the HTML course and add a <style> block that changes the background and heading colour.
  2. Change just the CSS in the example above (not the HTML) to give it a totally different look.

🏠 Homework

  1. Write two sentences: what is the difference between HTML and CSS, in your own words?
Want to learn this with a mentor?

CodingClave runs guided, project-based training (28-day, 45-day & 6-month batches).

Explore Training →