Building a web page with HTML tags : Now you can write HTML tags, let’s look at how we can use them to code a more complex web page.
As you’ve just seen earlier, if you write text between the opening and closing p tag as illustrated below:
<p>This text is between the opening and closing p tag. It will get displayed on screen.</p>
Text between p tag will appear on-screen. But just having one block of text on our web page won’t look very exciting.
If we want to make new lines or paragraphs we have to learn new tags.
We need to put these new tags between our opening and closing body tag as illustrated below:
<body> <!–– This comment is between our opening and closing body tag. ––> </body>
Putting tags inside other tags is called nesting.
Nesting tags allow us to create more exciting page layouts.
Let’s look at an example of nesting with the < body > and the < p > paragraph tag:
<body> <p>Hello World!</p> </body>
The < p > tag is used inside the < body > tag, this is an HTML element nesting example.
White space around your HTML doesn’t matter.
However, programmers like to indent their code every time they open a new tag.
It helps them keep track of when they’ve opened and closed a tag and makes the code block easier to read.
To indent, press Tab every time you open a new tag.
Let’s learn about the tags you need to make paragraphs and line breaks.
The code in the tags is very simple. It’s just a shorter way of saying “paragraph” and “break”.
All our tags are written using lowercase and there are no spaces between the tags and text!
We add the spaces in the post for readability. The code snippets follow proper programming syntax.