DEV Community

Hiral
Hiral

Posted on

Understanding HTML Tags and Elements

HTML (Hypertext Mark language)
HTML is language used to create webpages.HTML provides the structure of webpage and css used to style and design that structure.

HTML Tags
HTML tags is like label that tell browser what kind of content it is dealing with. Tags are wrapped in angle bracket <>.
eg.
<p>Text goes here</p>

  • -> opening tags

  • Text goes here -> content
  • ->closing tags An HTML Element is complete package: opening tag ,content and closing tag

Some HTML elements don't have closing tag they are called void elements

  • <br>
  • <hr>

Block level Elements
Block level element that start on new line and take up full width

  • <div>Testing</div>
  • <p>content</p>
  • <h1>Heading</h1> Each appear on its own line ,stacked vertically

Inline Elements
This elements stay with the flow of text and only width as much as needed:

  • <span>Testing</span> -<a href="test.html">Testing</a> They appear side by side on the page.

Commonly used HTML Tags

Headings

  • <h1>Heading1 </h1>
  • <h2>Heading2</h2>
  • <h3>heading3</h3> h1 is largest heading - h6 is smallest

Paragraph

-<p>Paragraph</p>

Containers

  • <span>small text</span>
  • <div>Bold text</div>

Link and images

  • <a href="google.com>google</a>
  • <img src="logo.png>

unordered List

<ul>
<li>item1</li>
<li>item2</li>
</ul>

ordered list

<ol>
<li>item2</li>
<li>item3</li>
</ol>

Top comments (0)