HTML StructureHTML is a web-specific language. It is utilized to organize the page layouts of a website or to create web pages. HTML is a markup language and not a programming language. As its full name refers, HYPERTEXT MARKUP LANGUAGE. So, we won't see any such errors when running HTML code. Because the browser displays HTML code, HTML code was never actually compiled or interpreted. HTML Document Structure- <!DOCTYPE html>: There must be an introduction. When HTML was first developed (around 1991-1992), doctypes were intended to serve as links to standards that an HTML page must conform to be recognized as acceptable HTML, which may mean automated error checking and other helpful features. Today, however, they primarily ensure that your document acts appropriately and does nothing else.
- <html></html> - the <html> element: Sometimes referred to as the root element, this element encloses all the page's content. The lang property, which specifies the document's default language, is also included.
- <head></head> - the <head> element: This element serves as a container for whatever you wish to incorporate on the HTML page but isn't showing the users of your page. This comprises elements like character set declarations, keywords, and a page summary that you wish to show up in search results.
- <meta charset="utf-8">: The character set that should be used in your work is UTF-8, which contains most of the characters from most written languages. In essence, it can now handle whatever text you add to it. Setting this up can prevent specific issues in the future, and there is no reason not to include this one in the document.
- <meta name="viewport" content="width=device-width">: By ensuring that the page renders at the viewport width, this viewport element stops mobile browsers from delivering pages that are broader than the viewport (screen) and then scaling them down.
- <title></title> - the <title> element: This determines the title of your page, which is shown in the browser tab where the page is loaded. When you bookmark or favourite a page, it can also describe the page.
- <body></body> - the <body> element: This includes all the material, including text, photos, videos, games, playable audio tracks, and other media, that you wish to display to website visitors when they visit your page.
Anatomy of an HTML Element- The Opening Tag: The Opening Tag is the first HTML element denoted by angle brackets (< >). It includes the tag name, another term for the name of the HTML element. For instance, the starting tag for a "division" element is "<div>".
- Closing Tag: Which is likewise enclosed in angle brackets, marks the conclusion of an HTML element. It has a similar appearance to the opening tag, except the tag name is preceded by a forward slash (/). It denotes the point at which the element's content terminates. For instance, the concluding tag "</div>" matches the initial tag "<div>".
- The Content: The text between an HTML element's opening and closing tags is known as the content. It can consist of any mix of text, graphics, links, and other HTML components.
- The Element: The opening tag, closing tag, and any in-between content combined, known as an HTML element. These components work together to define the element's function and appearance. Complex structures can be built by nesting elements inside of one another.
|