Monday, 9 January 2017

HTML Interview Questions

 HTML Interview Questions

image
 HTML Interview Questions

 How do I create frames? What is a frameset?
Frames allow an author to divide a browser window into multiple (rectangular) regions. Multiple documents can be displayed in a single window, each within its own frame. Graphical browsers allow these frames to be scrolled independently of each other, and links can update the document displayed in one frame without affecting the others.
You can't just "add frames" to an existing document. Rather, you must create a frameset document that defines a particular combination of frames, and then display your content documents inside those frames. The frameset document should also include alternative non-framed content in a NOFRAMES element.
The HTML 4 frames model has significant design flaws that cause usability problems for web users. Frames should be used only with great care.


How can I include comments in HTML?
Technically, since HTML is an SGML application, HTML uses SGML comment syntax. However, the full syntax is complex, and browsers don't support it in its entirety anyway. Therefore, use the following simplified rule to create HTML comments that both have valid syntax and work in browsers:

An HTML comment begins with "<!--", ends with "-->", and does not contain "--" or ">" anywhere in the comment.

How comfortable are you with writing HTML entirely by hand?
Very. I don’t usually use WYSIWYG. The only occasions when I do use Dreamweaver are when I want to draw something to see what it looks like, and then I’ll usually either take that design and hand-modify it or build it all over again from scratch in code. I have actually written my own desktop HTML IDE for Windows (it’s called Less Than Slash) with the intention of deploying it for use in web development training. If has built-in reference features, and will autocomplete code by parsing the DTD you specify in the file. That is to say, the program doesn’t know anything about HTML until after it parses the HTML DTD you specified. This should give you some idea of my skill level with HTML.

What is a DOCTYPE? Which one do I use?
According to HTML standards, each HTML document begins with a DOCTYPE declaration that specifies which version of HTML the document uses. Originally, the DOCTYPE declaration was used only by SGML-based tools like HTML validators, which needed to determine which version of HTML a document used (or claimed to use).
Today, many browsers use the document's DOCTYPE declaration to determine whether to use a stricter, more standards-oriented layout mode, or to use a "quirks" layout mode that attempts to emulate older, buggy browsers.

Can I nest tables within tables?
Yes, a table can be embedded inside a cell in another table. Here's a simple example:

How can we embed Audio in HTML 5?
TML 5 comes with a standard way of embedding audio files. Supported audio formats are MP3, Wav and Ogg.
<audio controls>
<source src="jamshed.mp3" type="audio/mpeg">
Your browser doesn't support audio embedding feature.
</audio>

What are the different types of storage in HTML 5?
HTML 5 has the capability to store data locally. Previously, it was done with the help of cookies. The exciting thing about this storage is that it's fast as well as secure.

There are two different objects which can be used to store data:
• localStorage object stores data for a longer period of time even if the browser is closed.
• sessionStorage object stores data for a specific session.

What are the new Form Elements introduced in HTML 5?
There are a number of new form elements that have been introduced in HTML 5 as follows:
• datalist
• datetime
• output
• keygen
• date
• month
• week
• time
• number
• range
• email
• url

What is the difference between HTML 5 Application Cache and regular HTML Browser Cache?
One of the key features of HTML 5 is "Application Cache" that enables us to make an offline version of a web application. It allows to fetch few or all of website contents such as HTML files, CSS, images, JavaScript, etc. locally. This feature speeds up the site performance. This is achieved with the help of a manifest file defined as follows:
<!doctype html>
<html manifest="example.appcache">
.....
</html>
As compared with traditional browser caching, it's not compulsory for the user to visit website contents to be cached.

How do I display the current date or time in my document?
With server-side includes. Ask your webmaster if this is supported, and what the exact syntax is for your server. But this will display the local time on the server, not for the client. And if the document is cached, the date will of course be incorrect after some time.
JavaScript can be used to display the local time for the client, but as most people already have one or more clocks on their screen, why display another one?

How do I get my visitor's e-mail addresses?
You can't. Although each request for a document is usually logged with the name or address of the remote host, the actual username is almost never logged as well. This is mostly because of performance reasons, as it would require that the server uses the ident protocol to see who is on the other end. This takes time. And if a cache proxy is doing the request, you don't get anything sensible.
In Netscape 2.0, it was possible to automatically submit a form with a mailto as action, using Javascript. This would send e-mail to the document's owner, with the address the visitor configured in the From line. Of course, that can be "mickey.mouse@disney.com". This is fixed in Netscape 2.01.
The most reliable way is to put up a form, asking the visitor to fill in his e-mail address. If you offer him something in return, he will most likely do it.

Is there a way to get indexed better by the search engines?
Yes. Put these two statements in the <HEAD> part of your documents:

<META NAME="keywords" CONTENT="keyword keyword keyword keyword">
<META NAME="description" CONTENT="description of your site">

Should I use lower case or upper case for tags?
Tags are case insensitive, so it doesn't matter. This is just a matter of style. Many people prefer upper case, as it makes the tags "stand out" better amongst the text.

Should I put quotes around attribute values or not?
It depends. It is never wrong to use them, but you don't have to if the attribute value consists only of letters, digits, periods and/or hyphens. This is explained in the HTML 2.0 specs.
Oh, and keep in mind that if you use double quotes, you should escape any quotes inside the value with "&quot;" so you don't accidentally terminate the value prematurely.

How do I get a button which takes me to a new page?
This is done with a small form:

<FORM ACTION="http://url.you.want.to.go.to/" METHOD=GET>
<INPUT TYPE=submit VALUE="Text on button" NAME=foo>
</FORM>

Which tag is used to display a webpage inside another webpage in HTML?
Iframe

HTML Form Events ___________, fires the moment that the element loses focus.
-onblur

What is cell padding?
-Used to separate cell walls from their contents.

What is the difference between XML and HTML?


EmoticonEmoticon