What are HTML Empty Elements?
Empty elements of HTML code are those HTML elements that have start tags but do not have an associated end tags. So these are the HTML elements which can contain only attributes associated within them but no content by themselves.
Sometimes, HTML Empty elements are also called as Void Elements of HTML.
Some of the interesting features of Empty Elements of HTML includes:
- They can never have raw text or CDATA associated within themselves.
- They can never have any additional child nodes in the DOM tree.
A list of HTML Empty Elements are as follows:
- <br> Insert A Line break
- <hr> Insert A Horizontal line
- <img> Insert an image from a file in the path defined by its “src” attribute
- <meta> Defines the metadata of a web page
- <source> Insert a media file
- <link> Used only in a document header to link in an external resource
- <input> Used to declare an input element to accept user input.
Hope this gave you good idea about what HTML tags are considered HTML Empty elements. I will continue to write further on more such lesser known information related to web development in future articles as well.
Until next time, happy coding! 🙂