In this chapter, we will learn about some extra things about HTML that are not covered in earlier chapters.
Comments are used to improve the readability and understandability of the code for the user.
Comments can also be used around blocks of code to stop that code from being displayed in the browser.
The comments are visible only in the code and not shown on the web page. In HTML the syntax of writing comments is as follows:
<!—comment goes here-->
Some elements always start from a new line in the browser window and take the full width available. These are known as block-level elements. Some examples are <h1>, <p>, <ul> and <li>.
Some elements appear to continue on the same line as their neighboring elements. It only takes as much width as necessary. These are known as inline elements. For example, <a>, <b>, <img> etc.
It is used as a container for other HTML elements. It is used to group text and elements in a block.
In a browser, the contents of <div> element will start from a new line, but other than this it will make no difference to the presentation of the page. When used together with CSS, the <div> element can be used to style blocks of content.
It is used for grouping text and elements inline. It is generally used to differentiate one inline element from the other surrounding inline elements.
<span> element is also used so that the appearance of the content of the elements can be controlled using CSS.
The <meta> element lives inside the <head> element and contains information about the web page. It uses attributes to carry information.
The most common attributes are the name and content attributes. <meta> element is an empty element which means that it doesn’t have any closing tag.