Reference Page: HTML|CSS|Java-Script|Angular|React

HTML Links : Learn     Interview Questions     Software IDE HTML Jobs : Indeed.com     ZipRecruiter.com     Monster.com

HTML Interview Questions - Page 2

< Previous Page              Next Page >
Question: What is the purpose of <!DOCTYPE html> in HTML5?
Answer: The <!DOCTYPE html> declaration is used to indicate to the web browser that the document is written in HTML5 markup language.
It ensures that the browser renders the web page in standards mode, avoiding any compatibility issues.

Question: Can you explain the difference between GET and POST methods in HTML forms?
Answer: The GET method submits form data as part of the URL query string, visible to users and limited in length.
And POST method sends form data in the request body, not visible to users and can handle large amounts of data.

Question: Can you explain the difference between 'id' and 'class' attributes in HTML?
Answer: The 'id' attribute is used to uniquely identify an element on a web page, while the 'class' attribute is used to group elements together and apply styles to them.

Question: Can you explain the difference between inline elements and block-level elements in HTML?
Answer: Inline elements flow within the content and do not start on a new line, while block-level elements start on a new line and take up the full width available.

Question: What is the purpose of the <head> and <body> tags in HTML?
Answer: The <head> tag contains metadata about the HTML document, such as title, stylesheets, scripts, and character set. And the <body> tag contains the main content of the web page.

Question: How do you add a comment in HTML?
Answer: Comments in HTML are created using the <!-- --> syntax. Anything within these tags is not rendered by the browser and is used for adding notes or explanations in the code.

Question: What is the purpose of the 'href' attribute in the <a> tag?
Answer: The 'href' attribute specifies the URL of the page or resource that the hyperlink points to. Clicking on the link navigates the browser to the specified URL.

Question: What is the purpose of the type attribute in the <script> tag?
Answer: The type attribute specifies the MIME type of the script. In HTML5, it is optional and defaults to "text/javascript". However, it can be used to specify other script languages like "text/typescript" or "application/ecmascript", etc.

Question: Can you explain the purpose of the <table>, <tr>, <td>, and <th> tags in HTML?
Answer: These are the tags and are used to structure tabular data. Below please find their use:
<table> is used to create a table
<tr> represents a table row
<td> represents a table data cell
<th> represents a table header cell.


< Previous Page Next Page >