Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING INTRO TO HTML & CSS BASH RUST

HTML and CSS Introduction


HTML & CSS: Introduction

This tutorial blends the core HTML markup skills with the CSS styling techniques you need to build real websites.


What you will learn

  • How HTML structures content using semantic, accessible elements.
  • How CSS controls layout, colors, typography, and responsive behavior.
  • How to combine HTML and CSS to build reusable components and full projects.
  • Best practices for accessibility, performance, debugging, and deployment.

Course map

This tutorial starts from the basics and gradually adds more skills.

Each chapter builds on the previous one:

  • Setup: Configure your tools, create your first HTML and CSS file, and learn workflow tips.
  • Foundations: Master HTML structure, text, lists, media, forms, and reusable snippets.
  • Styling Core: Work with selectors, cascade rules, typography, colors, and the box model.
  • Layout: Build flexible layouts with positioning, Flexbox, Grid, and responsive patterns.
  • Enhancements: Add polish with custom properties, functions, transitions, transforms, and animations.
  • Quality: Ensure accessibility, performance, maintainability, and efficient tooling.
  • Projects: Apply everything in guided projects and prepare for deployment.

Use the left-hand menu (or the menu icon on mobile) to navigate between lessons.



How to study

  1. Read the explanations carefully. We highlight important definitions and gotchas.
  2. Run the embedded examples. Edit the HTML and CSS to immediately see the result.
  3. Complete the exercises and challenges at the end of each topic.

Tip: Create a dedicated project folder for the entire course.

Save each experiment so you can compare improvements over time.


Try it now

See how HTML elements and CSS rules work together on the same page:

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Hello HTML and CSS</title>
  <link rel="stylesheet" href="styles.css" type="text/css">
</head>
<body>
  <main>
    <h1>Welcome, Web Creator!</h1>
    <p>This box is built with HTML structure and CSS styling.</p>
    <p><mark>Edit the code</mark> to change colors, fonts, or layout.</p>
    <button>Start Building</button>
  </main>
</body>
</html>
body { 
  font-family: "Segoe UI", sans-serif; 
  background:#f2f6fb; 
  margin:0; 
}
main {
  max-width: 600px;
  margin: 60px auto;
  background:#fff;
  padding:32px;
  border-radius:8px;
}
h1 {
  color:#04AA6D;
  margin-top:0;
}
mark { 
  background:#fffd91;
}
button { 
  background:#04AA6D; 
  color:#fff; 
  border:none; 
  padding:12px 24px; 
  border-radius:999px; 
  cursor:pointer; 
}
button:hover { 
  background:#028a56; 
}
Try it Yourself »

Use the Try it Yourself editor to experiment as you follow along.


Prerequisites

  • No prior coding experience is required. We start from the ground up.
  • An eager mindset and willingness to practice will help you succeed!


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.