HTML Basics
Basic Tags & Elements used in HTML
To built a huge building what we need to put some small small bricks, stones and concrete. In similar way to write any program we need to know basics of those programs. In this page we are gonna study about all the basic things in a html webpage in very simple manner. Let's enjoy!
Tags
HTML tags are like keywords which defines that how web browser will format and display the content. With the help of tags, a web browser can distinguish between an HTML content and a simple content. HTML tags contain three main parts: opening tag, content and closing tag. But some HTML tags are unclosed tags.
When a web browser reads an HTML document, browser reads it from top to bottom and left to right. HTML tags are used to create HTML documents and render their properties. Each HTML tags have different properties.
An HTML file must have some essential tags so that web browser can differentiate between a simple text and HTML text. You can use as many tags you want as per your code requirement.
- All HTML tags must enclosed within < > these brackets.
- Every tag in HTML perform different tasks.
- If you have used an open tag <tag>, then you must use a close tag </tag> (except some tags)
Syntax
<tag> content </tag>
*never miss the closing of tag </tag>
*some tags are need not to be closed and also don't contain any kind of data, thus called Empty tag. e.g. <input>, <br>, etc.
Is HTML case sensitive?
The answer is NO, html isn't case sensitive.
What is Case Sensitive?.............click here
HTML Elements
Elements are nothing but the whole statement including tags opening to tag data and tag closing.
e.g. <h1> This is Level 1 Heading</h1>
the given example have a <h1> tag which make text Huge heading.
After the concept of element there's another concept of Nested Element. If you have studies any programing language you must have read about nested loops, here also word nested has same meaning. No problem if you have not read yet, let me make it clear for you.
If we put a some element inside other element then it is called Nested Element.
eg. We always write body of the page in <body> tag
<html>
<body>
<p> this is example</p>
</body>
</html>
Here what we did? We nested body tag inside html tag and also nested paragraph tag inside body tag.
Attributes
Sometime we need to add more details about tags and attributes are used for the same. Let's understand about attributes by an example:
e.g. <input type="date">Enter Your Date of Birth</input>
Here what we want to take a input from user in date format so we instructed our input tag to take only input in date format. Here type="date" is an attribute of input element. We can have some other examples like <p id="firstpara">This is an example para</p>. What we did here is given an id to the para. We use a bunch of paragraphs in a webpage but while applying CSS(to make page stylish) if we need to target specific paragraph we have to give it some id (we will study about IDs and Classes in CSS deeply). For Now just understand id="anyID" is an attribute in HTML tags for targeting specific tag while styling.
*Get some most used Attributes in html
*attributes are always written in open tags (as <tag attribute>.................</tag>)
*attributes always contains two part name and value, as <tag attributeName:"value">........</tag>
Comments
Post a Comment