HTML code informs about the structure and presentation of a webpage. Without it, a computer would not know how to display text in any nuanced way.
The tag refers to the brackets and what lives in them (is this a header?, a paragraph?, etc) whereas an element includes the opening/closing tags as well as the content/info the tags contain.
Attributes supply additional info about the content of an element. We use them to further label elements so that code can be applied to all elements with a particular attribute.