HTML Interview Questions
This page contains HTML interview questions and answers.
We can create script
tags and write JavaScript code like the following.
<script>
document.write("Hello World");
</script>
Or we can include an external JavaScript file in the HTML page using the script tags.
<script src="path/to/script.js"></script>
To create an email link we have to set the href
attribute of an anchor tag to the desired email address as shown below.
<a href="mailto:contactus@example.com">Contact us</a>
HTML supports 6 types of heading from h1
to h6
.
<h1>Hello World</h1>
<h2>Hello World</h2>
<h3>Hello World</h3>
<h4>Hello World</h4>
<h5>Hello World</h5>
<h6>Hello World</h6>
We create telephone links in HTML as follows.
<a href="tel:+910000000000">Contact Us: +91 00 000 00000</a>
For that we have to create a meta
tag in the head
of the page and set the following attributes.
<meta http-equiv="refresh" content="0; url=https://dyclassroom.com" />
iframes are the HTML elements that allows us to embed document within the current HTML page.
Both the GET and POST methods are used to send request to the server.
The GET method is mostly used to fetch data from the server.
The POST method is mostly used to send data to the server.
Following are the differences between GET and POST method form submission.
GET | POST |
---|---|
The form data is appended in the URL and set as name/value pair. | The form data is appended inside the body of the HTML request. |
There is a character limit for GET request (like 2048 characters) | There is no limit for the POST request. |
Form-data via GET can be easily bookmarked. | Form-data via POST can't be bookmarked. |
This is not recommended when submitting sensitive data like user login email and password as it can be bookmarked and misused later. | This is preferred when submitting sensitive data as it can't be bookmarked. |
For this we can use the font
tags.
In the following example we are changing the font size of a piece of text to 20 pixels using font
element.
<p>The quick <font size="20">brown fox</font> jumps over the lazy dog.</p>
Block element always starts from a new line and takes up the entire width available.
Inline elements don't starts from a new line and takes up only necessary width.
Some of the block elements are listed below:
div
form
p
table
Some of the inline elements are listed below:
span
a
sup
sub
ADVERTISEMENT