02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Creating Our First Tag

In this video, we dive into the basics of creating your first HTML code. Learn about HTML tags: how they define the start and end of elements like paragraphs using opening and closing tags. Discover why closing tags are critical for well-structured pages and avoid creating broken HTML. By the end, you'll understand how to write a simple paragraph tag and render it in a browser.

Build your foundation in HTML: HTML Training with Mom.

Video Transcript

00:00So let's start looking into how to create code
00:04I'm going to go back into my code editor
00:07and in my code editor. Where we type in our code is a code editor
00:12What I wanna do is I wanna create a first simple HTML file
00:18The way it works is really simple.
00:20Let's even take a step back.
00:22We're talking about there is titles in websites.
00:25If I go back into our browsers samples - you have your title
00:29you see - Learning better is better.
00:31And there is a paragraph underneath it that is smaller
00:33and as we scroll around you see that some titles are smaller
00:36and some are bigger
00:37and some have links, and some have images
00:40now, how does the program know where the title start
00:44and where the title ends
00:45Basically, that's where html comes in
00:47and where html defines the starting place of the title
00:51and the ending place of the title
00:53The starting place of anything really.
00:55and the ending place of anything
00:57To do that, there is very simple rule that is always applied
01:01in every single thing you're going to learn from now on
01:04You have a '< ' and then you have a 'name' and then ' &gt;'
01:10And this literally tells the program
01:12from here there is a beginning of something
01:15this is going to be the name
01:16So for example, let's say there is a title
01:19that's called 'p' which is a paragraph
01:21So now you know that paragraph just started
01:23and we could type here: 'things'
01:26Whatever we want we type, we type we are happy
01:28-Oh this is 'shit' that's not a good idea!
01:31- Didn't I teach you better than that ?
01:32-Very better, yes
01:37The only problem is that...
01:38Now we started a paragraph
01:40We know how to create your paragraph
01:42How do we know how to end a paragraph?
01:44That's where closing tags come in
01:46and this a really critical skill to know
01:48Without it you're going to create broken pages
01:50you have to be able to tell the browser:
01:51Whatever I want starts here, whatever I want stops there
01:55So to say it we close the tag by using '/ '
02:00-What do we call that sign ?
02:03- slash ?
02:04- Slash I guess. Right, so you take the same tag as for opening
02:08you just close it with '/ ' before the actual name of the tag
02:12-Okay!
02:12Now if I save this and go to my browser
02:15We will see that already now
02:17if we go into that page again and click on refresh
02:19We will see that 'things this great'
02:21Oh that's a beautiful sentence
02:24Things this great , yeah I'm so shocked by the beauty of that sentence
02:33-What do you think about that so far?
02:35-Okay, I got it ! Not too hard.
02:37There is opening tags and there is closing tags.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!

Lesson notes

Creating Our First Tag

In this tutorial, we’ll take our first steps into writing actual HTML code! You’ll learn the basics of HTML tags, including opening and closing tags, and why they’re critical to building well-structured web pages.


1. What are HTML Tags?

HTML uses tags to tell the browser where an element starts and where it ends. Tags are enclosed in angle brackets <>.

  • Opening Tag: Marks the start of an element.
  • Closing Tag: Marks the end of an element. It uses a forward slash / before the tag name.

Here’s the simple syntax for an HTML tag:

<name> Content goes here </name>

For example, the <p> tag is used to define a paragraph:

<p> This is a paragraph. </p>
  • <p>: The opening tag for the paragraph.
  • </p>: The closing tag that tells the browser where the paragraph ends.

2. Why Are Closing Tags Important?

Closing tags are critical because they ensure the browser correctly interprets your code. If you forget a closing tag, your web page might break or behave unexpectedly.

Think of opening and closing tags like bookends—they wrap around your content to keep it organized.


3. Creating Your First HTML Tag

Let’s go step-by-step to write your first tag:

  1. Open Your Editor:

    • Use a plain text editor like Sublime Text or Notepad.
    • Create a new file.
  2. Write Your Code:
    Type the following HTML code into the editor:

    <p> This is my first paragraph! </p>
    
  3. Save the File:

    • Save the file as HelloWorld.html (ensure the extension is .html).
    • Place it on your desktop or a folder where you can find it easily.
  4. View It in a Browser:

    • Drag and drop the HelloWorld.html file into your web browser (e.g., Chrome, Firefox, Safari).
    • You should see the text "This is my first paragraph!" displayed on the web page.

4. Breaking Down the Tags

Let’s analyze the tags we just created:

PartDescriptionExample
Opening TagStarts the paragraph<p>
ContentThe text displayed on the pageThis is my first paragraph!
Closing TagEnds the paragraph</p>

5. What If You Forget the Closing Tag?

If you forget the closing tag </p>, the browser may not know where the paragraph ends, and it could mess up the layout of your page.

For example, this code is incorrect:

<p> This is my first paragraph!

To fix it, always include the closing tag:

<p> This is my first paragraph! </p>

Summary

By the end of this tutorial, you’ve learned:

  1. What HTML tags are and how they work.
  2. The difference between opening and closing tags.
  3. How to create and display your first HTML tag (<p>).

What’s Next?

In the next tutorial, we’ll explore HTML titles and more tags that help organize your web pages. Get ready to build on what you’ve learned!