It seems to me that’s what’s starting from <
up to the >
, as well as has opening tag:
<nomedatag>
And closing tag
</nomedatag>
And the element would encompass the opening tag until the closing tag, then the element would be all of this (having content or not):
<nomedatag>Conteudo</nomedatag>
In this case the element can contain more tags and text (texts are also considered "nodes/nodes"), element seems to me that is something considered by the interpreter (as a "parser") or rendering engine, in this case would get as element same, but I could be wrong about this last point.
It is worth remembering that there are elements of the "void type", which have no closing tag, as examples:
In these cases the understanding is that from <
up to the >
would be the tag and also the element.
I’m not even assuming here browsers only, because an interpreter may not be from a browser, it may be for example the:
That make the interpretation of the document and can obtain the "element", already the type of content (for example in Phrasing content) is irrelevant to determine what is the element, because the content is only part of it, and does not change what is element.
HTML document can refer:
- the page itself
- to a static HTML file
- Or simply "DOM processed" by the engine (HTML interpreter)
Now "page" itself seems to me a generic term, it can be of different formats, both HTML and other types of page as examples:
- swf ("dead", was the flash)
- images
- pdf
Of course, engines usually process a pre-html to ship different types of documents, but this is a browser feature and not a rule
Thanks! but in the case of my examples who is who? or else element is the same thing that tag and vice versa?
– joão batista
@Joãobatista element all are, because all represent something, even if the user does not see on the screen. So everything is tag, and everything is element, what varies is the type of element, and whether it is an element at the interface level (visible on the screen), or at the code level (only visible to HTML interpreters). The code of your example does not make much sense, there vc has an HTML tag, which in one case is empty
:empty
, or with a content inside. The tag does not need to have content to be an element as you can see in the reply. Qq thing speaks there– hugocsl
@joãobatista edited the answer, see at the end of it, how I used your code and CSS to style an empty element
– hugocsl
Thank you very much, hugocsl! helped a lot, another doubt that stayed about my question, was on a site that I had seen that spoke HTML document is the file with
.html
already the page would be the visible part that the user will see when accessing the site, this is right? or as a rule everything is the same thing? html document is the same thing as page?– joão batista
@joãobatista depending on the context may be right what you saw, but I believe it is wrong, because you may have HTML tag inside files, . PHP, . JS, . ASP, and so on... doesn’t need to be an . HTML to have HTML tags. Vc can have an HTML in a . TXT, and use another language to take this HTML and put it on a page. Also, a page can be . PHP, not even need to be . HTML rss, already in my view an HTML document is only HTML even if you have the
<!DOCTYPE html>
declared within it, regardless of whether it is a page or a loose fraction of code– hugocsl
True! You’re absolutely right, thanks for the strength.
– joão batista