DEV Community

Lokesh
Lokesh

Posted on

Basic HTML Tags

HTML stands for HyperText Markup Language. It is used to create the structure of a webpage.

Let's look at some commonly used HTML tags with simple examples.

1. Heading Tags

HTML provides six heading tags, from <h1> to <h6>.

<h1>Main Heading</h1>
<h2>Subheading</h2>
<h3>Smaller Heading</h3>
Enter fullscreen mode Exit fullscreen mode

<h1> represents the highest-level heading, while <h6> represents the lowest-level heading.

2. Paragraph Tag

The <p> tag is used to display a paragraph.

<p>This is my first webpage.</p>
Enter fullscreen mode Exit fullscreen mode

It is useful for writing descriptions and other text.

3. Link Tag

The <a> tag is used to create links to other webpages or websites.

<a href="https://www.google.com">Visit Google</a>
Enter fullscreen mode Exit fullscreen mode

The href attribute specifies the destination of the link.

4. Image Tag

The <img> tag is used to display images on a webpage.

<img src="photo.jpg" alt="My Photo">
Enter fullscreen mode Exit fullscreen mode
  • src specifies the image location.
  • alt provides alternative text describing the image.

5. List Tags

HTML supports ordered and unordered lists.

Unordered list:

<ul>
    <li>HTML</li>
    <li>CSS</li>
    <li>JavaScript</li>
</ul>
Enter fullscreen mode Exit fullscreen mode

Ordered list:

<ol>
    <li>Learn HTML</li>
    <li>Learn CSS</li>
    <li>Learn JavaScript</li>
</ol>
Enter fullscreen mode Exit fullscreen mode

<ul> creates a bulleted list, while <ol> creates a numbered list. The <li> tag represents each list item.

6. Button Tag

The <button> tag is used to create a clickable button.

<button>Click Me</button>
Enter fullscreen mode Exit fullscreen mode

Buttons can be used for actions such as submitting forms or triggering JavaScript functions.

7. Division Tag

The <div> tag is used to group HTML elements together.

<div>
    <h2>About Me</h2>
    <p>I am learning web development.</p>
</div>
Enter fullscreen mode Exit fullscreen mode

It is commonly used to organize webpage sections and apply CSS styling.

8. Line Break Tag

The <br> tag creates a line break.

Hello World!<br>
Welcome to HTML.
Enter fullscreen mode Exit fullscreen mode

The second line appears below the first line.

Top comments (0)