Creating Basic HTML Structure
Introduction and Lesson Goal
Hello, and welcome to our journey into coding with HTML! HTML stands for HyperText Markup Language and it is the standard language used to create webpages, much like English is a standard language used around the world for communication.
When we visit a website, what we see on our screens is a mix of HTML, CSS, and potentially other coding languages. But at its core, every webpage begins with HTML. Think of HTML as the skeleton or frame of a house, providing the basic structure and organization. Our goal today is to understand this basic structure and use HTML to start building a simple static to-do list.
Understanding HTML
Let's dive in a little deeper. HTML was invented by a physicist named Tim Berners-Lee in 1990 to allow scientists to share documents. Since then, it has evolved and is now maintained by the World Wide Web Consortium (W3C).
HTML uses tags to describe the content of a webpage. HTML tags are like containers that tell the browser how to display the content inside them. Common examples include <html> which wraps all the content on the page, <head> that typically includes metadata about the page, <title> that gives the page a title (displayed in your web browser's tab), and <body> which contains all the visible content of the page.
Let's imagine we're visiting a library. The library (webpage) is the <html>. The library's information board (metadata) would be the <head>, the library's name (website title) would be the <title>, and the actual books and resources (visible content) would be the <body>.
Basic HTML Structure
Now that we have some understanding of HTML, let's get our hands into coding! The basic structure of any HTML document can be fashioned as follows:
The <!DOCTYPE html> declaration helps with the proper rendering of the webpage by telling the browser that the document type is HTML5. The <html> tag wraps all the page content, while <head> typically includes link tags, meta tags, and the title of the page. Finally, the <body> tag contains all the content visible to the webpage viewer, such as text, images, videos, etc.
Note that while many tags need a corresponding closing tag, there are some that are self-enclosing. One example is the <img> tag: you do not need to add a </img> at the end.
