No history yet

Basic Web Development

The Building Blocks of the Web

Every game, app, or webpage you create on Websim is built with three core technologies: HTML, CSS, and JavaScript. Think of them like building a house. HTML is the structure, CSS is the decoration, and JavaScript is what makes everything work.

Lesson image

Together, they form the foundation of the modern web. Let's look at what each one does.

HTML: The Skeleton

HTML stands for HyperText Markup Language. It gives a webpage its fundamental structure. It's the text, links, images, and other content that make up the page. In our house analogy, HTML is the foundation, the walls, and the roof. It defines the spaces, like the kitchen, bedroom, and living room.

HTML uses tags to define different types of content. For example, <h1> creates a main heading, and <p> creates a paragraph. Each tag tells the web browser how to display the information. An HTML document is just a plain text file filled with these tags.

<!DOCTYPE html>
<html>
<head>
  <title>My First Page</title>
</head>
<body>

  <h1>This is a heading</h1>
  <p>This is a paragraph of text.</p>

</body>
</html>

This code creates a simple page with a title, a heading, and a paragraph. When you open this file in a web browser, it renders the content based on the tags.

Lesson image

CSS: The Style

CSS, or Cascading Style Sheets, is the language for describing the presentation of a webpage. It controls the colors, fonts, spacing, and layout. If HTML is the structure of the house, CSS is the paint, the furniture, and the interior design. It makes the house look good.

CSS works by selecting HTML elements and applying styles to them. You can select elements by their tag name (like h1 or p) and tell the browser how you want them to look.

/* This is a CSS comment */

body {
  background-color: #f0f0f0; /* A light gray background */
  font-family: sans-serif;
}

h1 {
  color: #005a9c; /* A nice blue color */
  text-align: center;
}

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

When you link this CSS file to the HTML file we saw earlier, the page's appearance changes completely. The heading becomes blue and centered, and the paragraph text has more readable spacing. CSS separates the look of a page from its content, which makes it much easier to manage.

JavaScript: The Action

JavaScript (JS) is the programming language that brings web pages to life. While HTML provides the structure and CSS adds the style, JavaScript adds interactivity. In our house analogy, JS is the electrical wiring and plumbing. It makes the lights turn on, the faucet run, and the doorbell ring.

With JavaScript, you can create games, respond to user clicks, validate forms, and fetch new data without reloading the page. It can manipulate the HTML and CSS of your page to change just about anything on the fly.

// Find the button element on the page
let myButton = document.querySelector('button');

// Find the heading element
let myHeading = document.querySelector('h1');

// A function that runs when the button is clicked
function changeHeading() {
  let newName = prompt('Please enter your name.');
  myHeading.textContent = 'Hello, ' + newName + '!';
}

// Tell the button to listen for clicks
myButton.addEventListener('click', changeHeading);

If we added a <button> to our HTML and linked this JavaScript file, clicking the button would pop up a box asking for your name. After you enter it, the heading on the page would change to greet you. This dynamic behavior is the core of what JavaScript does.

On Websim, you'll work with all three of these languages. HTML will define the elements of your game or page, CSS will make it look polished, and JavaScript will control the logic and make it fun and interactive for your users.

Ready to test your knowledge?

Quiz Questions 1/5

In the analogy of building a house, which technology is responsible for the 'paint, furniture, and interior design'?

Quiz Questions 2/5

What is the primary function of HTML?

Understanding these three technologies is the first major step toward creating anything on the web. As you build projects, you'll see how they constantly interact to create the experiences you want.