No history yet

Introduction to Web Development

The Blueprint of the Web

Every website you visit, from a simple blog to a complex online store, is built on a foundation of two core technologies: HTML and CSS. Think of them as the blueprint and the interior design of a house. One provides the structure, and the other makes it look good.

Learning HTML is the first step in web development, as it forms the basis for displaying information on the Internet.

HTML, which stands for HyperText Markup Language, isn't a programming language. It's a markup language, used to structure content and give it meaning. You use it to tell the browser, "This is a heading," "This is a paragraph," or "This is a list."

<!DOCTYPE html>
<html>
  <head>
    <!-- Meta-information goes here, like the title -->
    <title>My First Web Page</title>
  </head>
  <body>
    <!-- Visible content goes here -->
    <h1>Hello, World!</h1>
    <p>This is a paragraph of text.</p>
  </body>
</html>

This code creates a simple page with a main heading (<h1>) and a paragraph (<p>). The tags, like <h1> and </h1>, wrap around the content and define what it is. Most tags have an opening and a closing tag.

Lesson image

Using the right HTML tags for the right job is called using semantic HTML. For example, using a <h1> for your main page title tells search engines and screen readers what the most important text on the page is. This is a core principle of web accessibility, which is the practice of making sure websites are usable by everyone, including people with disabilities.

Adding Style with CSS

An HTML page on its own is pretty plain. That's where CSS comes in. Cascading Style Sheets (CSS) is the language we use to style an HTML document. It handles the colors, fonts, spacing, and layout. If HTML is the skeleton, CSS is the clothing and paint.

CSS allows you to apply styles to web pages. It separates the presentation from the structure, making your HTML cleaner and easier to manage.

You write CSS rules to target HTML elements and apply styles to them. For example, you could select all paragraphs and make their text red. Or you could select just the main heading and change its font.

/* This is a CSS comment */

body {
  font-family: sans-serif;
}

h1 {
  color: #0066cc; /* A nice shade of blue */
}

p {
  font-size: 16px;
  line-height: 1.5;
}

In this example, we're targeting the <body>, <h1>, and <p> elements. We're telling the browser to change the font for the whole page, make the heading blue, and adjust the size and spacing of the paragraph text. You link this CSS file to your HTML file, and the browser applies the styles.

Lesson image

Designing for Every Screen

Today, people browse the web on phones, tablets, laptops, and giant desktop monitors. A website needs to look good and be easy to use on all of them. This is called responsive design.

The main tool for responsive design in CSS is the media query. A media query allows you to apply certain CSS rules only when the screen size meets a specific condition. For example, you can tell the browser to use a larger font size on desktops and a smaller one on mobile phones.

/* Default styles for all screens */
.container {
  width: 90%;
  margin: 0 auto;
}

/* Styles for screens wider than 768px */
@media (min-width: 768px) {
  .container {
    width: 80%;
  }

  h1 {
    font-size: 3em;
  }
}

This code makes the main content area (.container) wider on larger screens and also increases the heading size. By thoughtfully applying these rules, you can create a single website that provides a great experience on any device.