Let's Review HTML & CSS! Free Software Engineering Bootcamp! (class 06) - #100Devs

3 min read 4 hours ago
Published on Nov 17, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

This tutorial provides a comprehensive overview of HTML and CSS concepts covered in class six of a free software engineering bootcamp. The focus is on web development fundamentals, which are essential for anyone looking to start a career in software engineering. By the end of this guide, you will have a solid understanding of basic HTML and CSS principles to build your own web pages.

Step 1: Understanding HTML Structure

HTML (HyperText Markup Language) is the backbone of web pages. It defines the structure and content of a webpage.

Key Elements of HTML

  • HTML Document Structure:

    • Every HTML document starts with <!DOCTYPE html>.
    • The root element is <html>.
    • Inside <html>, you have <head> and <body> sections.
  • Common Tags:

    • <head>: Contains meta-information, links to stylesheets, and the title.
    • <title>: Sets the title of the webpage.
    • <body>: Contains all the content that will be displayed (text, images, links, etc.).

Example HTML Skeleton

<!DOCTYPE html>
<html>
<head>
    <title>My First Webpage</title>
</head>
<body>
    <h1>Hello, World!</h1>
    <p>This is my first webpage.</p>
</body>
</html>

Step 2: Learning CSS Basics

CSS (Cascading Style Sheets) is used to style and layout web pages. It controls the look of HTML elements.

CSS Syntax

  • CSS rules are made up of selectors and declarations.
  • A declaration consists of a property and a value.

Example CSS Rule

h1 {
    color: blue;
    font-size: 24px;
}

Adding CSS to HTML

There are three ways to add CSS:

  1. Inline: Add styles directly in an HTML tag.
    <h1 style="color: blue;">Hello, World!</h1>
    
  2. Internal: Use a <style> tag within the <head>.
    <style>
        body {
            background-color: lightgray;
        }
    </style>
    
  3. External: Link to a separate CSS file using a <link> tag.
    <link rel="stylesheet" type="text/css" href="styles.css">
    

Step 3: Creating a Simple Web Page

Now that you understand HTML and CSS basics, let’s create a simple webpage.

Instructions

  1. Set Up Your File:

    • Create an HTML file (e.g., index.html).
    • Create a CSS file (e.g., styles.css).
  2. HTML Structure:

    • Use the HTML skeleton provided in Step 1.
    • Add more content like images and links.
    <p>This is a paragraph with a <a href="https://www.example.com">link</a>.</p>
    
  3. Style Your Page:

    • In styles.css, add styles to enhance your webpage.
    body {
        font-family: Arial, sans-serif;
        margin: 20px;
    }
    p {
        color: darkgray;
    }
    
  4. Link CSS to HTML:

    • Make sure to link your CSS file in the <head> section of your HTML document.

Conclusion

In this tutorial, you learned the foundational aspects of HTML and CSS, including how to structure a webpage and apply styles. By practicing these concepts, you can create visually appealing websites. Next steps could involve exploring more complex HTML elements, CSS properties, and responsive design principles to further enhance your web development skills.