• Check out world news on HeadLinesList.com
  • Forum registration is now open for public.
Hello There, Guest! Login Register

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is the difference between an HTML element and an HTML container?
From what I understand:

An HTML tag, with opening and closing tags, define the start and end of an element.

An HTML container can contain relevant tags but are also defined by HTML opening and closing tags, so a div container is anything inside.


But isn't that the same as an HTML element? Do they refer to the same entity?


yes HTML container is similar to DIV tags which are the open and closing </>. Just imagine HTML is a big box(container) and DIV is a smaller box in it.


They're both tags and elements but each has a use. A container doesn't describe the content. For example, a <p> element is used to let the computer know that the content is a paragraph. Containers like <div> and <span> have no special meaning and are used for presentation purposes. A <div> might be used to contain several paragraphs into an article and <span> might be used to highlight the title of a book within a paragraph.

– Dominic
a few HTML5 elements are containers, their purpose is simply to group other elements for styling purpose, interactivity purpose, or other purposes
see a demo for the div element:

"An HTML container can contain relevant tags" = not relevant tags but the allowed tags
e.g. see the allowed children of the head container for example



Forum Jump:

Browsing: 1 Guest(s)