Open Source Projects
This page contains HTML interview questions and answers.
HTML or Hypertext Markup Language as the name suggests is a markup language that is used to create web pages.
DOCTYPE is the Document Type Declaration which tells the browser about the document type it receives.
In HTML5 we add the following DOCTYPE at the beginning of the file before the opening html tag.
HTML tags are the special symbols that wraps the content and tells the browser about the content type.
Tags are in pairs and we generally have an opening tag and a closing tag.
<tagName> Some content... </tagName>
Where, <tagName> is the opening tag and </tagName> is the closing tag.
In the following example we are showing a paragraph tag.
<p>This content is inside the paragraph tags.</p>
No. There are tags without closing pair.
Example: Input tag, Image tag, Break line tag are some without the closing pair.
In the following example we have just the opening tags.
<input type="text" name="username">
<img class="logo" src="path/to/image.png">
HTML element is a combination of an opening tag, the content and the closing tag.
In the following example we have a HTML element consisting of opening and closing paragraph tag and the text "Hello World".
We can create the following lists in HTML
Unordered list, Ordered list and Definition list.
Example of unordered list having 3 items.
Example of ordered list having 3 items.
Example of definition list having 3 definitions.
<dd>Hyper Text Markup Language</dd>
<dd>Cascading Style Sheet</dd>
Hyperlinks are the HTML elements that helps us to navigate from one web page to the next.
We create hyperlinks using the <a> anchor tag.
In the following example we are creating a hyperlink that will take us to the home page of dyclassroom website.
<a href="https://www.dyclassroom.com">Visit dyclassroom.com</a>
To create this we have to enclose an img tag inside the a tag.
In the above example we have the anchor tag having href attribute set to the home page of dyclassroom website. You can use any other link. Then the src attribute of the image tag is set to the dyclassroom logo image file. You can use any other image link.
Comment in HTML starts with <!-- and ends with -->.
In the following example we have commented out some HTML elements.
<p>This is the first paragraph.</p>
<!-- <p>This one is commented out.</p> -->
<p>Also commented out</p>
<title>Sample HTML page</title>
Have fun learning :-)
Copyright © 2014 - 2018 DYclassroom. All rights reserved.
rendered in 0.0348 sec