Teyro
CoursesFor creatorsBlog
Log inGet started
Tey Mascot
LOADING.

Every expert you admire was once a beginner who refused to quit.

Teyro

The fun way to finish learning coding and AI: short daily lessons with streaks, leagues and friends.

Get the app

Learn

  • All courses
  • Learn coding
  • Learn AI
  • Learn online
  • How it works
  • Leagues
  • Get the app

Creators

  • Teach on Teyro
  • How teaching works
  • Teach coding online
  • Teach AI online
  • Join as a Founding Creator
  • Creator log in

Resources

  • Blog
  • Features
  • Use cases
  • Compare
  • FAQ

Legal

  • Terms of Use
  • Privacy Policy

© 2026 Teyro · support@teyro.app

HomeBlogSkill Building & Careers
Skill Building & Careers

CSS Tutorial for Beginners: Styling, Flexbox and Grid Explained

A beginner CSS tutorial: how CSS works, selectors, the box model, Flexbox and Grid with simple examples you can try, and how to practise for free.

The Teyro TeamOct 25, 20262 min read
On this page11 sections
  1. Direct answer
  2. How a CSS rule works
  3. Selectors
  4. The box model
  5. Flexbox: a row or column
  6. Grid: rows and columns
  7. Making it work on phones
  8. Practice tips
  9. Where Teyro fits
  10. The bottom line
  11. More web guides

CSS makes web pages look good. This tutorial covers the ideas you need first, with short examples.

Direct answer

CSS is a set of rules that style HTML. Each rule picks an element (a selector) and sets properties like colour, size and spacing. Learn selectors, the box model (margin, border, padding), then Flexbox and Grid for layout. Practise by styling a real page.

How a CSS rule works

h1 {
  color: #1f3a93;
  font-size: 2rem;
}

h1 is the selector. Inside the braces are properties and values.

Selectors

p { line-height: 1.5; }          /* every paragraph */
.card { padding: 16px; }          /* anything with class="card" */
#intro { font-weight: bold; }     /* the element with id="intro" */

Classes are the ones you'll use most.

The box model

Every element is a box:

  • Content
  • Padding inside the border
  • Border
  • Margin outside the border
.card {
  padding: 16px;
  border: 1px solid #ddd;
  margin: 24px 0;
}

Flexbox: a row or column

.menu {
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

Flexbox lines items up and spaces them. Perfect for menus and rows of cards.

Grid: rows and columns

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

Grid makes three equal columns. Perfect for galleries.

Making it work on phones

Layouts need to adapt. See what is responsive web design.

Practice tips

  • Style a page you've built with HTML.
  • Change one value at a time and watch.
  • Use the browser's inspect tool to experiment.

Where Teyro fits

Teyro's Responsive Web Design with CSS course turns a simple page into a real site: tidy cards, a proper header, galleries that line up and layouts that rearrange for phones. Start with HTML & CSS for Beginners if you're new. Both are free to start.

The bottom line

Learn the box model, then Flexbox and Grid. Everything else builds on them.

More web guides

  • How to learn HTML and CSS
  • HTML tutorial for beginners
  • What is responsive web design?
  • Responsive CSS course

Frequently asked questions

What is CSS?

Cascading Style Sheets, the language that controls how HTML looks: colours, fonts, spacing and layout.

What is Flexbox?

A CSS layout tool for arranging items in a row or column and spacing them evenly. It is great for menus and card rows.

What is CSS Grid?

A layout tool for arranging items in rows and columns at once, useful for galleries and page layouts.

Should I learn Flexbox or Grid first?

Start with Flexbox for one-direction layouts, then learn Grid for two-dimensional ones. Most sites use both.

Where can I practise CSS for free?

In a browser with a text editor, or with an interactive course. Teyro's CSS courses are free to start.

Practise CSS on a live page

Responsive Web Design with CSS teaches cards, headers, Flexbox and Grid on a live page. 100 short lessons, free to start.

See the Responsive CSS course

Free to start · No credit card needed

Share

Written by

The Teyro Team

Learning Team at Teyro

We build Teyro — an AI-powered learning platform that turns skill-building into a daily habit through bite-sized, gamified lessons. We write about the learning science and study strategies that shape our product.

More from The Teyro Team

On this page

  • Direct answer
  • How a CSS rule works
  • Selectors
  • The box model
  • Flexbox: a row or column
  • Grid: rows and columns
  • Making it work on phones
  • Practice tips
  • Where Teyro fits
  • The bottom line
  • More web guides

Keep reading

Skill Building & Careers

Best Careers for 2027: High-Demand Jobs and the Skills to Get Them

The best careers for 2027 and the jobs most in demand, based on BLS and World Economic Forum data, plus the skills each path needs.

Oct 30, 20263 min read
Skill Building & Careers

Best Certifications for 2027: Tech, Data, Cloud and Business

The best certifications for 2027 in cloud, security, data, project management and AI, who each one suits, and when a portfolio matters more.

Oct 30, 20263 min read
Skill Building & Careers

Best Programming Language to Learn in 2027 (for Your Goal)

The best programming language to learn in 2027 depends on what you want to build. Compare Python, JavaScript, TypeScript, SQL and C.

Oct 30, 20263 min read