Chapter 2: CSS Basics

Lesson 1: Introduction to CSS

CSS, or Cascading Style Sheets, is used to make your web pages look attractive. It's like adding colors, fonts, and layouts to your HTML structure.

Let's change the appearance of our previous HTML page:

  1. In the same index.html file, add the following inside the section:
<style>
    body {
        font-family: Arial, sans-serif;
        background-color: #f3f3f3;
        margin: 0;
        padding: 0;
    }
    header {
        background-color: #333;
        color: white;
        text-align: center;
        padding: 10px;
    }
    nav ul {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    nav li {
        display: inline;
        margin-right: 20px;
    }
    footer {
        text-align: center;
        padding: 5px;
    }
</style>
    1. Save and refresh your page in the browser.

    You've just added styles to your HTML elements!