0% found this document useful (0 votes)
2 views4 pages

9 HTML Interview Questions

The document contains a list of 9 HTML interview questions along with their answers, covering topics such as disabling HTML elements, the difference between <div> and <span>, and using the HTML Geolocation API. It provides practical code examples for tasks like transposing a table and formatting links with CSS. The document is aimed at helping individuals prepare for web development interviews.

Uploaded by

subbareddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

9 HTML Interview Questions

The document contains a list of 9 HTML interview questions along with their answers, covering topics such as disabling HTML elements, the difference between <div> and <span>, and using the HTML Geolocation API. It provides practical code examples for tasks like transposing a table and formatting links with CSS. The document is aimed at helping individuals prepare for web development interviews.

Uploaded by

subbareddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

18/07/2025, 11:24 9 HTML Interview questions

« Web / HTML Interview questions »

1. How will you disable all the html elements within a HTML Table?

2. When does a body onLoad gets called/executed?

3. How will you enable all the html elements within an html table?

4. Difference between <div> and <span> element.

5. How to display &lt; and &gt; using html without transforming it to & and >?

6. How do I invert/transpose the rows and columns of a HTML table?

7. HTML 5: How do you find the user's location or position?

8. What are the common CSS pseudo classes for formatting links.

9. What are the properties for removing underlines and borders of link?

Could not find what you were looking for? send us the question and we would be happy to answer your question.

1. How will you disable all the html elements within a HTML Table?

$('#tableID').find('select,input,textarea').attr('disabled','disabled');

2. When does a body onLoad gets called/executed?

The load event fires at the end of the document loading process. At this point, all of the objects in the document
are in the DOM, and all the images and sub-frames have finished loading.

3. How will you enable all the html elements within an html table?

$('#tableID').find('select,input,textarea').removeAttr('disabled');

4. Difference between <div> and <span> element.

<div> is a block level element and it helps to group html elements.

<span> is an inline element and it also helps in grouping html elements.

5. How to display &lt; and &gt; using html without transforming it to & and >?

Escape the & using &amp;.

https://www.javapedia.net/HTML-Interview-questions 1/4
18/07/2025, 11:24 9 HTML Interview questions

Change this

<h1>&lt;test-Link &gt;</h1>

To the below.

<h1>&amp;lt;test-link &amp;gt;</h1>

6. How do I invert/transpose the rows and columns of a HTML table?

Save the below content into a file with .html extension and open it in browser.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>

<html>
<head>

</head>
<script>
$( document ).ready(function() {
$("#tableID").each(function() {
var $this = $(this);
var newTransposedRow = [];
$this.find("tr").each(function(){
var i = 0;
$(this).find("td").each(function(){
i++;
if(newTransposedRow[i] === undefined) { newTransposedRow[i] = $("<tr></tr>"); }
newTransposedRow[i].append($(this));
});
});
$this.find("tr").remove();
$.each(newTransposedRow, function(){
$this.append(this);
});
});
});
</script>
<body>
<table id="tableID">

<tr>
<td>R1C1</td>
<td>R1C2</td>
<td>R1C3</td>
</tr>
<tr>
<td>R2C1</td>
<td>R2C2</td>
<td>R2C3</td>
</tr>

</table>

</body>
</html>

7. HTML 5: How do you find the user's location or position?

The HTML Geolocation API is used to get the geographical position of a user.
https://www.javapedia.net/HTML-Interview-questions 2/4
18/07/2025, 11:24 9 HTML Interview questions

Since this could possibly compromise user's privacy, the position is not available unless the user approves it.

The getCurrentPosition() method is used to get the user's position.

<html>
<head>
<script>
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
alert ("Geolocation is not supported by this browser.");
}
}
function showPosition(position) {
alert( "Latitude: " + position.coords.latitude +
"\nLongitude: " + position.coords.longitude);
}
</script>

</head>
<body onload = 'getLocation()'></body>
</html>

8. What are the common CSS pseudo classes for formatting links.

A link that hasn't been visited. Blue is the default color. visited A link that has been visited. Purple is the default
color. :hover An element with the mouse hovering over it. Hover has no default color. :focus An element like a link
or form control that has the focus. :active An element that's currently active. Red is the default color. The
properties for removing underlines and borders
Name Description
:link .
a:link {
color: green;
}
a:hover, a:focus {
text-decoration: none;
font-size: 110%;
}

9. What are the properties for removing underlines and borders of link?

text-decoration : To remove the underlining from a link, set this to none.

border-style: To remove the border from an image link, set this to none. You can also set the border-width
property to 0.

https://www.javapedia.net/HTML-Interview-questions 3/4
18/07/2025, 11:24 9 HTML Interview questions

« JSP interview questions »

Comments & Discussions

0 Comments 
1 Login

G Start the discussion…

LOG IN WITH OR SIGN UP WITH DISQUS ?

Name

 Share Best Newest Oldest

Be the first to comment.

Subscribe Privacy Do Not Sell My Data

Interviews Questions

Java
Spring
Hibernate
Maven About Javapedia.net
Testing
Javapedia.net is for Java and J2EE developers, technologist and
API college students who prepare of interview. Also this site includes
BigData many practical examples.
Web
DataStructures This site is developed using J2EE technologies by Steve Antony, a
senior Developer/lead at one of the logistics based company.
Database
MuleESB
Cloud
Scala
Tools

contact: javatutorials2016[at]gmail[dot]com

Kindly consider donating for maintaining this website. Thanks.

Copyright © 2020, javapedia.net, all rights reserved. privacy policy.

https://www.javapedia.net/HTML-Interview-questions 4/4

You might also like