HTML Technical Interview Questions

What is HTML?

HTML stands for Hyper Text Markup Language. It is a type of markup language that has become the standard for creating web pages and web applications that can be displayed or shared on the internet. It was first developed by Tim Berners-Lee in 1990, and has constantly been updated since then.

HTML is one of the most popular markup languages, primarily because it is easy to learn and universally used and accepted. Most people can grasp the basis in just one sitting. HTML primarily uses HTML tags to mark the text on the page that is created.

HTML makes use of HyperText, which creates special text called hyperlinks. These hyperlinks can be used to connect to other pages on the internet, leading to the creation of the framework of the information available on the World Wide Web.

What are HTML Tags?

HTML tags are perhaps the single most important aspect of HTML. As their name suggests, HTML tags are used for tagging. They tag a section of the content which decides how that content will be formatted. The tags are usually hidden, which means that they cannot be seen in the browser. However, the can be read by the browser and indicate to the browser how to format and display.

Most HTML tags come in pairs: the opening tag and the closing tab. The content in between these tags is formatted as indicated by the tag. The closing tag is the same as the opening tag, but with a slash in it, i.e. /. For example: <bold> is the opening tag and </bold> is the closing tag; the content in between these tags will be displayed as bold in the browser. Additionally, <html> and </html> are the opening and closing tags for the entire html page.

Do all HTML tags have end tag?

HTML tags are useful as they indicate to the browser how the content should be formatted and displayed in the browser. Most of the HTML tags come is a set of pairs i.e. an opening tag, and a closing tag. The closing tag is the same as the opening tag except with a slash in it. Eg. <bold> and </bold>, which is the closing tag.

However, not all html tags come in pairs. Some of them do not have end tags. Examples of these kinds of tags include:

<image> tag – used to input an image

<br> tag – used to input a break line

<hr> tag – used to input a horizontal rule

There are a lot more. Usually the tags used for images, object, and such do not have closing tags.

What is semantic HTML?

Semantic HTML is a special usage of HTML. It is a type of coding style where the HTML Markup is used to reinforce the semantics, or meaning, of the information in webpages and web applications. This is usually in contrast to the typical usage of HTML which is to define the presentation or the look of the content. Semantic HTML can be processed by most traditional web browsers, as well as by many other user agents. CSS is usually used in order to facilitate the presentation of Semantic HTML for human users.

For example: In Semantic HTML, instead of using <bold> and </bold> to indicate bold, <strong> and </strong> are used instead to indicate a bold statement.

What is the difference between HTML elements and tags?

HTML Tags and Elements are both important factors in the usage of the HTML. While many may consider that they are the same, the truth of the matter is that they are different.

HTML Tags are used to mark up the start and end of an HTML element. For example: <p> </p>; <p> is the starting tag, and </p> is the end tag.

HTML Elements, on the other hand, is slightly different. An element represents some kind of structure or semantics and generally consists of a start tag, content, and an end tag. For example:

<p>

This is the content of the paragraph element.

</p>

Hence, it can be said that HTML tags are part of HTML elements.

How do you insert a comment in HTML?

Inserting anything in HTML requires one thing, it requires an HTML tag. Similarly, for inserting a comment in HTML, one would use the comment tag, <!-- … -->

For example:

<!-- Write HTML comments here -->

However, it should be noted that using the comment tag inserts a comment in the source code. This comment will not be displayed in the browser and can only be seen in the HTML code. The benefit of inserting comments in the HTML code is that they can be used for guidance or to put certain information, such as changes made or changes that need to be made. They can be used as communication devices to leave notes for another person working on the code, or for the future self.

Do all character entities display properly on all systems?

While a number of character entities may display properly on all systems, there are still some that cannot be displayed in certain situations. The primary reason that the character entities might not be displayed properly is when the operating system on which the browser is running does not support the characters then the characters may be displayed as boxes.

What are some common lists that are used when designing a page?

There are a number of lists that can be used when designing a page. Some on the popular lists that can be included are:

  • ordered list
  • unordered list
  • definition list
  • menu list
  • directory list

These lists can be used individually or by combining two or more list types together. Each of the list types uses a different tag set to compose. Another option is to make lists with form elements, such as <select> and <option> list tags

What is the advantage of collapsing whitespace?

The advantage of collapsing whitespace is that the HTML code becomes neat and is in a much more readable form. Blank spaces in HTML are treated as a single space character. So, the browser makes multiple spaces into a single space, codes can be written without worrying about the multiple spaces.

Is it possible to list elements straight in an html file?

Yes, it is possible to list the elements in straight line in html. This can be done by using indents for it. Indents specify the amount of white space that is put before texts.

No, hyperlinks do not apply only to text. They can be used for images also. Applying hyperlink to text or images means that you make it into a link, which when clicked opens another page.

No, hyperlinks do not apply only to text. They can be used for images also. Applying hyperlink to text or images means that you make it into a link, which when clicked opens another page.

What hierarchy is being followed when in style sheets?

A style sheet generally decides what type of formatting should be applied at a particular section. There are three style sheets in CSS:

  1. Inline Styling
  2. Internal Styling
  3. External Styling

The highest priority is of Inline styling, followed by internal styling and then external styling. If all three are present, inline override internal styling and internal overrides external styling.
 

What happens if the list-style-type property is used on a non-list element like a paragraph?

If the list-style-type property is used on a non-list element like a paragraph, the property is ignored and it will have no effect on the paragraph.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.