Introduction to HTML & CSS

What is HTML?

HTML (HyperText Markup Language) is the standard language for creating web pages. It structures content using elements like headings, paragraphs, and links.

Example:

<!DOCTYPE html>
<html>
<head>
    <title>My Page</title>
</head>
<body>
    <h1>Welcome</h1>
    <p>This is a paragraph.</p>
</body>
</html>

What is CSS?

CSS (Cascading Style Sheets) is used to style HTML elements, controlling layout, colors, fonts, and more.

Example:

<style>
h1 {
    color: blue;
    text-align: center;
}
p {
    font-size: 16px;
    color: #333;
}
</style>

Combining HTML & CSS

HTML provides the structure, while CSS adds the visual design. They work together to create modern websites.

Combined Example:

<!DOCTYPE html>
<html>
<head>
    <title>Styled Page</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
        }
        .container {
            max-width: 600px;
            margin: 0 auto;
            padding: 20px;
            background: white;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>Hello, World!</h1>
        <p>This is a styled webpage.</p>
    </div>
</body>
</html>