Scanner class Methods in Java

Tags In HTML

What are Tags?

HTML was designed with the intent of defining the architecture of documents headings, paragraphs, lists to share the information in understandable form. HTML is not case sensitive so you can write tags in both uppercase or lowercase. Lowercase is more convenient to me.
Tags are predefined keywords of HTML. We use tags to specify the purpose of information we are sharing in web pages.
For example-  <H1>Some Heading Here</H1>


Types of tags-

  1. Paired tags
  2. Unpaired tags

Paired Tags


Paired tags are the tags that have both opening and closing tags. These tags looks like slices of bread and everything is written between them. For example,
<html>
<!--all remaining elements here-->
</html>

In the above example the <html> is opening tag and </html> is closing tag. Let's see more example ,
such as:
<head>----</head> , <title>----</title> , <body>----</body>.

Unpaired Tags

Unpaired tags are the tags that have no closing tag. These tags have opening tags but no closing tag is required.  For example,
<br />: the line break tag
<hr> : horizontal rule tag

Hello World in HTML

Lets get started with HTML. We are going to write our first program in HTML.We'll be writing a Hello World as heading.
Now, the question arises where we can write HTML Code? Don't worry there are a lot of IDE's available for that. But to get started you can use basic application that is available in every computer or laptop.

Notepad

Notepad is the basic application available in each computer. You can simply open notepad by searching in search bar, after this start writing your code as follows:


Saving file in Notepad

To save file in notepad, first Click on File menu> Save As> Dialog Appears> Click Save.
You must save the file with the .html or .HTML  extension.
For example-  firstProgram.html

Checking the output of the program

To see the output of the program, Open the folder where your file is kept>double click the file.

File will get open in browser and you can see the output.

Basic Tags in HTML

Sr.NoTag & Description
1<!DOCTYPE...>

This tag defines the document type and HTML version.

2<html>

This tag encloses the complete HTML document and mainly comprises of document header which is represented by <head>...</head> and document body which is represented by <body>...</body> tags.

3<head>

This tag represents the document's header which can keep other HTML tags like <title>, <link> etc.

4<title>

The <title> tag is used inside the <head> tag to mention the document title.

5<body>

This tag represents the document's body which keeps other HTML tags like <h1>, <div>, <p> etc.

6<h1>

This tag represents the heading.

7<p>

This tag represents a paragraph.

Important points to remember: 

  1. Tags may or may not have closing tags. As there are two types of tags. Paired which must have closing tags and unpaired which do not need a closing tag.
  2. it is not important to add ID attribute to all tags. It is totally dependent on your need. You can add ID attribute to style that particular tag using CSS by ID attribute.
  3. Tags must  have opening tags.You need to specify tag and opening tag is must for each tag.
  4. Adding attributes to tag is your choice.
To learn fundamentals of HTML you can check the HTML tutorial.
Happy Coding!

Comments