HTML Interview Questions and Answers

What is the html frame?

With frames, you can display more than one HTML document in the same browser window. Each HTML document is called a frame, and each frame is independent of the others.

Are there any problems with using frames?

It is difficult to bookmark - and impossible to link or index - such a frameset state. 
Basic browser functions (e.g., printing, moving forwards/backwards in the browser's history) behave differently with framesets. Also, browsers cannot identify which frame should have focus, which affects scrolling, searching, and the use of keyboard shortcuts in general.

How do you target a specific frame from a hyperlink?

Include the name of the frame in the target attribute of the hyperlink.


<a href="mypage.htm" target="myframe" >My Page </a>

How do I make a picture as a background on my web pages?

Point the body background to the name of your image you wish to use as the background as shown below. This body line should be the first line after your </head> tag. 
<body background="picture.gif" >

How do I add scrolling text to my page?

Keep in mind not all browsers support scrolling text. however to do this add a marquee tag similar to the below example. 
<marquee>i m scrolling </marquee> 

i m scrolling
How do I make a picture a link?

Use the A HREF link tag around the IMG image tag as shown below. 
<A HREF="" > <IMG SRC= "title.gif" /> </A>

How do I make my page automatically jump to another page after a specified time?

the META tag is used for redirecting users to another page after a specified amount of time. Simply include the following tag in your page, where x is the number of seconds to wait until redirection, and is the URL that the user is being directed to. (The tag must be placed between the <head> and </head> tags.) 

<META HTTP-EQUIV="refresh" CONTENT="x"; URL="" />

Why Always Close Your Tags?

this is simply bad practice and should be 100% avoided. Always, always close your tags. Otherwise, you'll encounter validation and glitch issues at every turn.

Can you align a table to right or left?

Yes,To align the table to the right, you can use <TABLE ALIGN="right"> for the left, you can use <TABLE ALIGN="left">

Why we Consider Placing JavaScript Files at the Bottom?

the primary goal is to make the page load as quickly as possible for the user. When loading a script, the browser cannot continue on until the entire file has been loaded. Thus, the user will have to wait longer before noticing any progress.

If you have JS files whose only purpose is to add functionality we can place those files at the bottom, just before the closing body tag. This is absolutely a best practice.

What are the different types of Headings supported by HTML?

Html supports six heading starting from H1 to H6

What are differences between DIV and SPAN?

DIV is a block-level element and used as a container for HTML elements whereas a SPAN is an inline elementand working as a container for text;

Latest Updates