HTML is almost like a concept of ‘Paired Tags’. The idea of this concept is pretty simple – every HTML tag has both opening and closing tag. The opening tag starts with
'<' sign along with the appropriate tag of the element and then
'>' sign again.
The closing tag starts with
< and following with a backslash
'/' by the proceeding tag.
Let’s say you want to write a sentence as a ‘heading’. The opening tag will be like
<h1> and the closing tag will be like
</h1>. So if you combine both with your desired heading the HTML code will be like this-
So, what you gonna do if you want to put a paragraph in your code? What if you are considering to put a piece of text in bold format in that paragraph? Well that’s easy to guess, right? Yes, the Bold tag.
<p>This is a paragraph tag.</p>
<p>Something <b>Bold</b> Within a Paragraph</p>
This is just a common theory about how HTML tags are written. You can imagine much more like title, body, header, footer, audio, video, list, form, links etc. Almost all of the tags in HTML follow this simple rule.
Although some modern browsers are smart enough to thoroughly analysis the HTML beginning and closing tags. Even if you’ve mistakenly forgotten to write the closing tag, some browsers will still work as the way you wanted but some don’t. Therefore, it’s a good idea to always practice with both the beginning and closing tags of an element.
This rule is applicable for almost every HTML tags. But this concept is NOT universal for every HTML tags. That means it has some exceptions that don’t need any closing tag which is called singleton tags in HTML. We will see them in detail when we get to them.
Now that you know how to write HTML tags, the next thing you have to know is ‘how to structure a basic HTML page‘ and in the next blog post of this series, I’ll discuss this topic.
Journey to HTML is a series of blog posts I have created for those who are brand new to web design. If you missed the first part of this series you can take a look at Journey to HTML.
If you have any issues about this, make sure to comment below, I’ll try to answer those.
Thanks for stopping by. Happy coding.