Elements in HTML

Element

1) HTML element are the basic unit of html.

2) An html element consit of a opening tag , content and an closing tag. and can also attribute that provide additional info about the element.

3) Element = opening tag + content + closing tag.

Types of Elements

  • 1 Block Level Element
  • 2 Inline Level Element
  • Difference Between Block Level Element and Inline Level Element.

    Block Level Element


  • They will take/occupy full width of the container.
  • They always start an a new line.
  • We can set height & width for the block level element.
  • EX:< p > tag, all heading tag,< div > tag etc
  • Inline Level Element


  • They will take/occupy required by the container.
  • They do not start an a new line.
  • We cannot set height & width for the inline level element.
  • EX:< img > tag, < span >tag etc
  • How to attach or embed image to our webpage.

  • We need space first which is container.
  • So, for space we have image tag < img > < / img >
  • We need image and its path.
  • For this behave src attribute of < img > tag.
  • Syntax : src=""
  • What is < DOCTYPE > ?

  • It is document type declaration.
  • It is document type declaration of HTML 5 version.
  • It is not an html tags.
  • It is used to specified the version of HTML.
  • Comment in HTML

  • Comments are used to document the source code.
  • Comments are not displayed on the webpage.
  • Syntax : ctrl + /(forward slash)