DEV Community

Suma
Suma

Posted on • Edited on

Tags And Elements

TAGS

A tag is a keyword enclosed in angle brackets < > in HTML
Tags tell the browser what to display and how to display it
Most tags come in pairs: an opening tag and a closing tag

opening tags:
Marks the beginning of an element
ex:<p>

closing tags:
Marks the end of an element. it look the same but has a slash(/).
ex:</p>

TYPES OF TAGS

1.CONTAINER TAG:
these tags come in pairs: an opening tag and closing tag
the content is written between these two tags
ex:<p>this is a paragraph </p> , <h1> hello </h1>

2.EMPTY TAGS:
these tags don't have closing tag
they are used to insert something or make a break in content
ex:<hr> , <input>

ELEMENTS

An elements is everything from the opening tag to the close tag-including the content inside
An elements means the complete structure-opening tag + content + closing tag
ex:<h1> hello world </h1>
this whole thing is called an HTML element

TYPES OF ELEMENTS

1.BLOCK LEVEL ELEMENTS:
start on a new line
take up the full width of the page (from left to right)
often used to create structure in a webpage
ex:<div> , <p> , <header>

2.INLINE ELEMENTS:
Do not start on a new line
take only the space needed for their content
used to style or format small parts of text
ex:<a> , <b> , <strong>

Top comments (0)