HTML

Know About HTML Tags, Attributes, and Elements

We have already discussed that an HTML is a markup language in our previous article. Thus people use HTML tags to do marking up. So in this article, we will be discussing various HTML tags, attributes, and elements.

So let’s start with HTML tags and what they actually do?

HTML Tag:-

This is a tag name surrounded by < and > brackets.

For EX : <body> tag.

Here you can see body tag which is surrounded by < and > brackets and you will see a word “body” inside it which is a name of this tag i.e. body tag. It is put inside these brackets to denote that it is an HTML tag and like this, there are many more tags used in HTML which have different names like a body tag, image tag, paragraph tag etc.

Now, normally HTML tags consist of an opening tag and a closing tag like:

<p> and </p>

So you have tag with < and > sign and then the name of the tag inside it. Now to close that you put a slash in front of the name of the tag. So what it denotes to the browser is that anything inside of these tags is marked up with this specific tag and I want you to treat it in a particular way based on whatever that tag is.

So the second example used here is of the paragraph tag. Now, this especially comes into picture when you are dealing with CSS so that we can target these tags in our CSS. Means tell the browsers how to style specific tags and we can give names to the tags and so forth. This is the basic structure of an HTML tag looks like. There are exceptions that are called void tags.

Void Tags: –

These tags are called “Void Tags” because they cannot have any contents.

For ex: – The image tag:

<img src = “ourimage.jpg”>

So syntactically there is no reason for them to close because there are no contents to put inside them. So a really good example of it is above image tag.

This is a default image tag that you would use in your HTML. You notice inside this we have used an attribute about which we will talk about in a while. Which is a source which tells the browser where to find the image, we want to display. But you would also notice that there is no closing tag with it. You could see only an opening tag, that’s all you put when you use this image tag. That would be considered incorrect syntax.

This is what is called as Void tag and you would see some of these throughout the HTML as you learn it.

One thing that you could have seen that’s called “Self Closing Tags“.

Self-ClosingTags:-

This is a leftover from XHTML. Again the image tag is an example. Notice the closing “/” in this tag:

<img src = “ourimage.jpg”/>

The reason for this is because XML is a strict language which required every tag to be closed. But as explained earlier HTML has a Void tag where you have certain tags does not require any need to close them so we don’t need a closing tag for them.

This is no longer necessary. However, it’s a sort of compromise in XHTML, what are called this self-closing tags. Now in today’s article, we are not going in details about XHTML. But you may see that kind of code or coder who still uses them. But it is still a leftover of XHTML. If you see them then just remove that closing slash and use it like a normal HTML tag.

Let’s see Attributes:-

Attributes:-

So HTML tags may have attributes that further describes how the element should be displayed. So the basic structure of attribute is as follows:

Name of tag    Name of Attribute    Value of attribute

<tag attribute = “Value”>

Foe Ex : – <img src = “ourimage.jpg”>

Name of tag           Name of attribute     Value of attribute

Let’s discuss what does an attribute do?

This tells the browser for this image tag where you are going to find the image at ourimage.jpg.

This is called a relative path. So the browser will look whatever URL you happen to add so if you add google.com/about and if you want to add this image tag here then the browser will look out for google.com/about/ourimage.jpg for that image file. Of course, that may not be exactly how you want to structure your site so you can use what is called absolute URL’s. Where you can put in the full HTTP address of the image here. When you go to CSS, that, of course, may change a little bit but which may give you a basic idea of the attribute is that an attribute that further tells the browser further how they should use this.

The last thing is the Elements.

Elements: –

An Element is essentially an HTML tag and the content inside of it.

For EX:-

<h1>Content</h1>

Heading tag    Element   Closing tag

Level 1

Inside an opening and closing tag, we have our content that full tag and the content is referred to as an element. When someone says an element this is technically what they are talking about.

Although you would find the people quite often refer to tags and contents a bit interchangeably.

But it is important to understand what element is? Because when you start dealing with CSS then you will target an element inside of CSS, that’s something you hear a decent amount, that generally is being said in the technical sense and we not only referring to only to a tag as well as the content inside of that tag also.

Visit – Hostdens

Best Web Hosting Company


Vishwajit Kale

Vishwajit Kale blazed onto the digital marketing scene back in 2015 and is the digital marketing strategist of Hostdens, a company that aims to provide reliable web hosting solutions. Vishwajit is experienced in digital and content marketing along with SEO. He's fond of writing technology blogs, traveling and reading.
Vishwajit Kale

Vishwajit Kale blazed onto the digital marketing scene back in 2015 and is the digital marketing strategist of Hostdens, a company that aims to provide reliable web hosting solutions. Vishwajit is experienced in digital and content marketing along with SEO. He's fond of writing technology blogs, traveling and reading.

Leave a Comment
Share
Published by
Vishwajit Kale
Tags: 10 basic html tags15 html tags20 html tags20 tags of html50 html tagsa tags htmlall html codes with examplesall html tagsall html tags and attributesall html tags and attributes with examplesall html tags list with examplesall html5 tagsall tegsand html codebackground htmlbasic html codesbasic html codes listbasic html tagsbasic html tags and attributesbasic html tags listbasic html tags list with examplesbasic html tags with examplebasic tagsbasic website html codebest html codesbest html codes for web pagebest html tagsbrackets htmlcode htmlcode tagcode to htmlcodes for websitecoding websitescommon html tagscomplete html tagscomplete list of html tagscool html codescool html codes for websitescss code in htmldifferent html codesdifferent html tagsdynamic htmleasy htmleasy html codesexample of html program with all tagsexplain html tagsfive html tagsframes htmlfree htmlfree html codefree html codes for websites designfree website html codefull list of html tagsfull website html codehistory of htmlhow to use htmlhtmlhtml 1 tagshtml 4html 4 tagshtml all codeshtml all codes listhtml all tags with examplehtml and csshtml and tagshtml background codehtml basicshtml befehlehtml codehtml code examplehtml code forhtml code for creating a websitehtml code for homepage designhtml code for making websitehtml code for websitehtml code for website designhtml code helphtml code in htmlhtml code taghtml code tag examplehtml code tags listhtml code to create a web pagehtml code writerhtml codes and tagshtml codes for web designinghtml codes listhtml codes list for websiteshtml codes list with exampleshtml codes websitehtml coding for web pagehtml colorhtml commandshtml converterhtml creatorhtml csshtml css tags listhtml design codeshtml documenthtml downloadhtml examplehtml filehtml formhtml framehtml full codinghtml generatorhtml guidehtml headerhtml helphtml help workshophtml html taghtml javascripthtml kithtml langhtml menuhtml pagehtml page codehtml program using all tagshtml programshtml programs codehtml programs examples using all tagshtml programs using all tagshtml reference sheethtml scripthtml sitehtml source codehtml table codehtml taghtml tag namehtml tag name listhtml tag referencehtml tag sheethtml taglarıhtml tagshtml tags and attributes listhtml tags and attributes list with exampleshtml tags and codes listhtml tags and exampleshtml tags explanationhtml tags for web designinghtml tags listhtml tags list with exampleshtml tags programhtml tags used to create a web pagehtml tags uses and exampleshtml tags with examplehtml tutorialhtml videohtml webhtml web codehtml web page design codehtml websitehtml website tagshtml writerhtml5 codes listhtml5 html taghtml5 referencehtml5 tag referencehtml5 tagshtml5 tags listhtml5 tags list with examplesimportant html tagsjava htmllearn htmllist of all html elementslist of all html tagslist of all html tags and attributesmanual htmlmenu htmlother html tagsself htmlsimple htmlsimple html codesimple html tagssimple html tags liststandard html tagstag internetthe html tagto htmlto html codetotal tags in htmluse of htmluseful html codesvarious tags in htmlweb design tags listweb page codewebcodewebsite tags listwhere to code htmlwrite a html program using all tags

Recent Posts

Green Data Centers To Have Strong Impact On Data Processing And Hosting Service Businesses

About Bizvibe Bizvibe is a B2B online platform that helps in connecting buyers and sellers…

3 years ago

File Server Security Is Important for An Organization: Find out How

File server investment is the smart investment anyone can make for their business. It has…

3 years ago

Cloud Computing Explained

Because of the many advantages of the cloud, people are moving more and more towards…

3 years ago

Cloud to which more and more companies are moving advanced workloads

Cloud Adoption Accelerates IT Modernization. More and more online businesses are increasing more and more…

3 years ago

History of web hosting

Almost more than half of the total world’s population were using the internet by any…

3 years ago

Plesk appoints ZNet Technologies as a global distributor to expand reach in untapped markets

Plesk is an IT service provider company which was founded in 2000 by Dimitri. The…

3 years ago

This website uses cookies.