Html tags examples and uses

HTML Basic Examples

In this chapter we will show some basic HTML examples.

Don’t worry if we use tags you have not learned about yet.

HTML Documents

All HTML documents must start with a document type declaration: .

The HTML document itself begins with and ends with .

The visible part of the HTML document is between and .

Example

My First Heading

My first paragraph.

The Declaration

The declaration represents the document type, and helps browsers to display web pages correctly.

It must only appear once, at the top of the page (before any HTML tags).

The declaration is not case sensitive.

The declaration for HTML5 is:

HTML Headings

HTML headings are defined with the to tags.

defines the most important heading. defines the least important heading:

Example

This is heading 1

This is heading 2

This is heading 3

HTML Paragraphs

HTML paragraphs are defined with the

tag:

Example

This is a paragraph.

This is another paragraph.

HTML links are defined with the tag:

Example

The link’s destination is specified in the href attribute.

Attributes are used to provide additional information about HTML elements.

You will learn more about attributes in a later chapter.

HTML Images

HTML images are defined with the tag.

The source file ( src ), alternative text ( alt ), width , and height are provided as attributes:

Example

How to View HTML Source

Have you ever seen a Web page and wondered «Hey! How did they do that?»

View HTML Source Code:

Right-click in an HTML page and select «View Page Source» (in Chrome) or «View Source» (in Edge), or similar in other browsers. This will open a window containing the HTML source code of the page.

Inspect an HTML Element:

Right-click on an element (or a blank area), and choose «Inspect» or «Inspect Element» to see what elements are made up of (you will see both the HTML and the CSS). You can also edit the HTML or CSS on-the-fly in the Elements or Styles panel that opens.

Источник

HTML Basic Tags

Understanding basic HTML tags is important while learning HTML. Here are the HTML elements that are used more frequently than others. They are:

  • the heading — tags,
  • the tag,
  • the tag,
  • the tag,

HTML documents

All HTML documents must start with a declaration which specifies the document type: .

The HTML document begins with and ends with .

The main part of the HTML document is located between and .

Example of an HTML document:

html> html> head> title>Title of the document title> head> body> h1>This is heading 1 h1> h2>This is heading 2 h2> p>Here is the paragraph. p> body> html>

HTML headings

The heading elements are used for structuring headings.There are six types of HTML headings starting from to .

Example of the HTML headings:

html> html> head> title>Title of the document title> head> body> h1>This is heading 1 h1> h2>This is heading 2 h2> h3>This is heading 3 h3> h4>This is heading 4 h4> h5>This is heading 5 h5> h6>This is heading 6 h6> body> html>

Result

headings

HTML paragraphs

Example of the HTML paragraphs:

html> html> head> title>Title of the document title> head> body> h2>Elements example h2> p>This is some paragraph. p> p>This is another paragraph br/> with line break. p> body> html>

Result

paragraph

HTML images

The attributes of this tag are:

The tag is used for inserting HTML images.

Example of the HTML images:

html> html> head> title>Title of the document title> head> body> h1>This is an image example h1> img src="/uploads/media/default/0001/01/25acddb3da54207bc6beb5838f65f022feaa81d7.jpeg" alt="Aleq" width="200" height="185"/> body> html>

Result

Image example

The tag is used for inserting HTML links. You can specify the destination of the link with the help of href attribute.

html> html> head> title>Title of the document title> head> body> a href="https://www.w3docs.com/">W3docs.com a> body> html>

Result

Link example

HTML buttons

You can specify the HTML buttons with the tag.

Example of the HTML tag:

html> html> head> title>Title of the document title> head> body> h1>Example of the HTML <button> tag: h1> p>You can specify the HTML buttons with the button tag: p> button type="button">Button button> body> html>

HTML lists

Example of the HTML lists:

html> html> head> title>Title of the document title> head> body> h2>An unordered list h2> ul> li>Pen li> li>Pencil li> li>Ruler li> li>Book li> ul> h2>An ordered list h2> ol> li>Pen li> li>Pencil li> li>Ruler li> li>Book li> ol> body> html>

HTML horizontal lines

Example of the HTML


tag:

html> html> head> title>Title of the document title> head> body> h1>Welcome to W3Docs h1> hr> p> Learn to design and build professional websitebr> Learn to design and build professional website p> p>Learn to design and build a professional website p> hr> p>Learn to design and build professional website p> p>Learn to design and build professional website p> p>Learn to design and build professional website p> hr> body> html>

Источник

List of All Basic HTML Tags Exaplained with Example

Do you want to learn the most useful basic HTML tag that will be very useful in every web page development?

In this tutorial, you will find a list of all basic HTML tags. Knowing the syntax of these HTML tags will help you at every stage of your web page development.

learn HTML tags

HTML is markup language and it is used to create web pages. You can run HTML code in the browser so you don’t need any external software to test the HTML code from this tutorial.

The Syntax for All basic HTML tags with Example

In this tutorial, for practicing and running HTML code, use Online HTML editor. Copy the example code given below into the online HTML editor and run it.

Pro Tips: Executing code practically is always preferable and good practice for any programmers, rather than just reading it.

1) Creating HTML Paragraph

HTML has

tag to define the paragraph for the web page. The text inside the

and

tags will be considered as one paragraph.

 

Here is text from the first paragraph.

Here is text from the second paragraph.

If you run this code, you can see, every paragraph starts with the new line.

2) Setting Text Header in HTML

To defines the header in HTML, there are six tags from to . The tag has the most important whereas has the least important.

 

header one

header two

header three

header four

header five
header six

HTML Header tags with its importance.

HTML header tags

Usually, the font size of the header text decreases from tag to .

3) Different HTML Tags for Text Formatting

Following is the list of tags you can use for text formatting.

HTM Tags Description
Describes bold text
Describes emphasized text
Describes italic text
Describes smaller text
Describes important text
Describes subscripted text
Describes superscripted text
Describes inserted text
Describes deleted text
Describes marked/highlighted text

Description for each tag is straightforward to understand. Try using different text formatting tags in your HTML code to realize the difference between them.

Let’s make it bit entertaining 😉

HTML Tags for Text Formatting example

4) How to Add Table in HTML?

HTML code for table:

 
Student Name Class Score
Bob 10 78
Alice 9 67

Below image explains detail about HTML table tags.

HTML code for table explained

5) Linking other pages in HTML

You can add links in your HTML text.

There are two types of the link- internal link and external link. If you are linking page to your own website page, it is called as an internal link. If you are linking to any other website page, it is called as an external link.

HTML syntax for Adding Link:

Here, the link text is also called as anchor text.

6) How to create List in HTML?

There are two types of list- an ordered list and an unordered list.

    is used for unordered list. Tag
    is used for the ordered list.

An Unordered HTML List Example:

An Ordered HTML List Example:

Items in the ordered list are listed by ascending numbers.

HTML ordered unordered list

7) How to Add Images to your HTML page?

Here is Simple syntax for adding an image in your HTML page.

The src is an attribute to which you need to pass the complete path of the image.

You can also add some other attributes:

alt – This attribute is to define an alternative name for the image.

What is the use of the alt tag?

And there are many purposes for using it. This name will be shown to the user if the image is not able to load properly (because of poor internet connection). It is also used by the search engine to identify the image.

width and height – With these attributes, you can provide the dimensions of the image to display.

PS: The images displayed above in this post are the example of using the img HTML tag.

Other HTML tags you can use for Web development:

This is the complete list of all basic HTML tags. And you will be using them in almost every web page development. So, make the practice of using them.

Now a day, there are many online HTML editors available. With the simple drag and drop options, you can create HTML objects without worrying about syntax. But, it is still necessary to know the basic syntax for a better understanding of HTML and web development.

Источник

Читайте также:  Java web application stack
Оцените статью