Elements in HTML
The HTML element usually goes in pairs, including the opening tag, closing tag, and the content inside the two tags.
content
The HTML element is everything from the opening tag to the closing tag.
Example of HTML element
Learn HTML programming
HTML is a hypertext markup language.
- Open card is
- The content of the element is' Learn HTML programming 'and' HTML is hypertext markup language. '
- Close tag is
and
HTML elements without content are called empty elements. Empty element has no closing tag, for example
(used for line breaks).
Nested HTML elements
HTML elements can be nested (this element is in another element)
All HTML documents contain nested HTML elements.
The following example has 4 HTML elements.
Learn HTML programming
HTML is a hypertext markup language.
Explain the example
- Element
Defined for both texts, with open tags
and the closing tag is
. The content of this element is another element (that is
).
Learn HTML programming
HTML is a hypertext markup language.
- Element
Identify the entire body of the text, starting with the opening tag
and end with a closing tag
,
the content is 2 other HTML elements(
).
Learn HTML programming
HTML is a hypertext markup language.
- Element
,
the content is Learn HTML programming.
Learn HTML programming
- Element Identify the paragraph, including the opening tag and the closing tag is
,
the content is HTML is the hypertext markup language.
HTML is a hypertext markup language.
Don't forget the closing card
Although some HTML elements are still displayed correctly even if you forget the closing tag, the browser will still display the same way as the closing tag, for example, below.
Learn HTML programming
HTML is a hypertext markup language.
But don't rely too much on this because in other cases, it may cause an error when you forget the closing card.
Empty HTML element
Empty HTML elements are elements that do not contain content.
is an empty element, has no closing tag and is used to break the line.
Empty elements can 'close' at the opening tag like this
/>
HTML5 is not required to close the empty element. But if you want more rigorous validation or want your XML parsers to be readable, it's best to close all HTML elements properly.
Tags marked with uppercase and lowercase letters
HTML tags are not necessarily lowercase or uppercase,
good
are the same.
The HTML5 standard is not required to use lowercase letters, but W3C recommends lowercase letters in HTML and requires lowercase text for more demanding documents like XHTML.
Previous article: Basic examples of HTML
The following article: Properties in HTML
You should read it
May be interested
- Semantic Element in HTML5in html, each semantic element describes the structural significance of that element to browsers and developers / developers.
- Introduction to HTMLa few basic things to know about html before starting to learn this language.
- Input types of input elements in HTMLthe article introduces input data types for input elements.
- Computer code element in HTMLelements used to display computer code data in the browser
- 5 steps to learn a dynamic HTML web component profilehtml is an important part of websites we still use every day. however, not everyone can understand how a website is structured.
- Basic examples of HTMLin the previous html lesson, you know which tools to use to write html code, how to save and open html files. this article will give some basic examples of html text.
- eQuiz - Multiple choice test on HTML knowledgein this test, we will proceed with the small html test, there will be 30 questions in total with no response time, you must choose the answer in each question. can continue to the next sentence.
- Paths in HTMLyou can find links (links) throughout the web. link allows clicking to switch to another page.
- Why write neat and organized HTML?you will get many benefits from writing clean and precise html code. here's why it's a good idea to write optimal html code.
- Style properties in HTMLthe style attribute specifies the style for the html element.