html : Interview Questions

Answer:

HTML stands for Hyper Text Markup Language. It is a language of World Wide Web. It is a standard text formatting language which is used to create and display pages on the Web. It makes the text more interactive and dynamic. It can turn text into images, tables, links.

Answer:

HTML tags are composed of three things: an opening tag, content and ending tag. Some tags are unclosed tags.

HTML documents contain two things:

  • content, and
  • tags

When a web browser reads an HTML document, the browser reads it from top to bottom and left to right. HTML tags are used to create HTML documents and render their properties. Each HTML tags have different properties.

 content 

Content is placed between tags to display data on the web page.

Answer:

No. There are some HTML tags that don't need a closing tag. For example: tag,
tag.

Answer:

The HTML formatting is a process of format the text for a better look and feel. It uses different tags to make text bold, italicized, underlined.

Answer:

The HTML contains six types of headings which are defined with the

to

tags. Each type of heading tag displays different text size from another. So,

is the largest heading tag and

is the smallest one. For example:
 

Heading no. 1

Heading no. 2

Heading no. 3

Heading no. 4

Heading no. 5
Heading no. 6

Answer:

The HTML provides an anchor tag to create a hyperlink that links one page to another page. These tags can appear in any of the following ways:

  • Unvisited link - It is displayed, underlined and blue.
  • Visited link - It is displayed, underlined and purple.
  • Active link - It is displayed, underlined and red.

Answer:

There are many common lists which are used to design a page. You can choose any or a combination of the following list types:

  • Ordered list - The ordered list displays elements in numbered format. It is represented by
      tag.
    1. Unordered list - The unordered list displays elements in bulleted format. It is represented by
        tag.
      • Definition list - The definition list displays elements in definition form like in dictionary. The
        ,
        and
        tags are used to define description list.

Answer:

HTML elements communicate to the browser to render text. When the elements are enclosed by brackets <>, they form HTML tags. Most of the time, tags come in a pair and surround content.

Answer:

Semantic HTML is a coding style. It is the use of HTML markup to reinforce the semantics or meaning of the content. For example: In semantic HTML tag is not used for bold statement as well as tag is used for italic. Instead of these we use and tags.

Answer:

Image map facilitates you to link many different web pages using a single image. It is represented by tag. You can define shapes in images that you want to make part of an image mapping.

Answer:

You can insert a copyright symbol by using © or © in an HTML file.

Answer:

You can keep the list elements straight by using indents.

Answer:

No, you can use hyperlinks on text and images both. The HTML anchor tag defines a hyperlink that links one page to another page. The "href" attribute is the most important attribute of the HTML anchor tag.

 Link Text   
 

Answer:

A style sheet is used to build a consistent, transportable, and well-designed style template. You can add these templates on several different web pages. It describes the look and formatting of a document written in markup language.

Answer:

Yes. To create a multicolor text on a web page you can use for the specific texts you want to color.

Answer:

The color of the bullet is always the color of the first text of the list. So, if you want to change the color of the bullet, you must change the color of the text.

Answer:

Marquee is used to put the scrolling text on a web page. It scrolls the image or text up, down, left or right automatically. You should put the text which you want to scroll within the ...... tag.

Answer:

Three tags are used to separate the texts.


  • tag - Usually
    tag is used to separate the line of text. It breaks the current line and conveys the flow to the next line
  • tag - The

    tag contains the text in the form of a new paragraph.

  • tag - It is used to define a large quoted section. If you have a large quotation, then put the entire text within
    .............
    tag.

Answer:

To make a picture a background image on a web page, you should put the following tag code after the tag.

  
Here, replace the "image.gif" with the name of your image file which you want to display on your web page.

Answer:

HTML elements with no content are called empty elements. For example:
,


etc.

Answer:

The span tag is used for following things:

  • For adding color on text
  • For adding background on text
  • Highlight any color text

In this page we use span.

 

Answer:

The HTML character entities are used as a replacement for reserved characters in HTML. You can also replace characters that are not present on your keyboard by entities. These characters are replaced because some characters are reserved in HTML.

Answer:

No, the declaration is not an HTML tag. There are many type of HTML e.g. HTML 4.01 Strict, HTML 4.01 Transitional, HTML 4.01 Frameset, XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1 etc. So, is used to instruct the web browser about the HTML page.

Answer:

No, there are single HTML tags that do not need a closing tag. Examples are the tag and
tags.

Answer:

You can insert any or a combination of the following list types:
– ordered list
– unordered list
– definition list
– menu list
– directory list
Each of this list types makes use of a different tag set to compose

Answer:

Comments in HTML begins with “”. For example:

 

Answer:

No, there are some character entities that cannot be displayed when the operating system that the browser is running on does not support the characters. When that happens, these characters are displayed as boxes.

Answer:

Image map lets you link to many different web pages using a single image. You can define shapes in images that you want to make part of an image mapping.

Answer:

White spaces are a blank sequence of space characters, which is treated as a single space character in HTML. Because the browser collapses multiple spaces into a single space, you can indent lines of text without worrying about multiple spaces. This enables you to organize the HTML code into a much more readable format.

Answer:

Some attribute values can be set to only predefined values. Other attributes can accept any numerical value that represents the number of pixels for a size.

Answer:

To insert the copyright symbol, you need to type © or & #169; in an HTML file.

Answer:

By using indents, you can keep the list elements straight. If you indent each subnested list in further than the parent list that contains it, you can at a glance determine the various lists and the elements that it contains.

Answer:

Every web page on the web can have a separate web address. Most of these addresses are relative to the top-most web page. The published web address that appears within magazines typically points this top-most page. From this top level page, you can access all other pages within the website.

Answer:

When you use image maps, it can easily become confusing and difficult to determine which hotspots correspond to which links. Using alternative text lets, you put a descriptive text on each hotspot link.

Answer:

Yes, older HTML files are compliant to the HTML standard. Most older files work on the newer browsers, though some features may not work.

Answer:

No, hyperlinks can be used in the text as well as images. That means you can convert an image into a link that will allow users to link to another page when clicked. Surround the image within the tag combinations.

Answer:

In cases wherein their operating system does not support a particular character, it is still possible to display that character by showing it as an image instead.

Answer:

The

  • tag includes two attributes – type and value. The type attribute can be used to change the numbering type for any list item. The value attribute can change the number index.

  • Answer:

    Style sheets enable you to build consistent, transportable, and well-defined style templates. These templates can be linked to several different web pages, making it easy to maintain and change the look and feel of all the web pages within site.

    Answer:

    With ordered lists, you can select to use some different list types including alphabetical and Roman numerals. The type attribute for unordered lists can be set to disc, square, or circle.

    Answer:

    To create text with different colors, use the tags for every character that you want to apply color. You can use this tag combination as many times as needed, surrounding a single character or an entire word.

    Answer:

    The numerical values are taken from the ASCII values for the various characters, but these can be difficult to remember. Because of this, named character entity values were created to make it easier for web page designers to use.

    Answer:

    Although checkboxes don’t affect one another, grouping checkboxes together help to organize them. Checkbox buttons can have their name and do not need to belong to a group. A single web page can have many different groups of checkboxes.

    Answer:

    If two sets of HTML tags are overlapped, only the first tag will be recognized. You will find this problem when the text does not display properly on the browser screen.

    Answer:

    Applets are small programs that can be embedded within web pages to perform some specific functionality, such as computations, animations, and information processing. Applets are written using the Java language.

    Answer:

    If there is no text between the tags, then there is nothing to format. Therefore no formatting will appear. Some tags, especially tags without a closing tag like the tag, do not require any text between them.

    Answer:

    You can specify a border color using style sheets, but the colors for a table that does not use style sheets will be the same as the text color.

    Answer:

    To create hyperlinks, or links that connect to another web page, use the href tag. The general format for this is: text
    Replace “site” with the actual page URL that is supposed to be linked to when the text is clicked.

    Answer:

    Tables can be used to position text and images. Another useful way to wrap text around an image is to use style sheets.

    Answer:

    No. The anchor tag can accept only a single href attribute, and it can point to only a single web page.

    Answer:

    The key difference is that the directory and menu lists do not include attributes for changing the bullet style.

    Answer:

    The default size for a text field is around 13 characters. However, if you include the size attribute, you can set the size value to be as low as 1. The maximum size value will be determined by the browser width. If the size attribute is set to 0, the size will be set to the default size of 13 characters.

    Answer:

    Any tag can be changed to a tag. This causes the text contained within the tag to be displayed as bold in the browser. Although tags are mainly used for headings, they do not need to be used exclusively for headings.

    Answer:

    Default cell borders, with a thickness of 1 pixel, are automatically added between cells if the border attribute is set to a nonzero value. Likewise, If the border attribute is not included, a default 1-pixel border appears if the rules attribute is added to the tag.

    Answer:

    By default, the text is wrapped to appear within the browser window. However, if the text is part of a table cell with a defined width, the text could extend beyond the browser window.

    Answer:

    The default color for normal and active links is blue. Some browsers recognize an active link when the mouse cursor is placed over that link; others recognize active links when the link has the focus. Those that don’t have a mouse cursor over that link is considered a normal link.

    Answer:

    Style sheets do not limit the number of style definitions that can be included within the brackets for a given selector. Every new style definition, however, must be separated from the others by a semicolon symbol.

    Answer:

    If the list-style-type property is used on a non-list element like a paragraph, the property will be ignored and do not affect the paragraph.

    Answer:

    Frames can make navigating a site much easier. If the main links to the site are located in a frame that appears at the top or along the edge of the browser, the content for those links can be displayed in the remainder of the browser window.

    Answer:

    The browser sizes the frames relative to the total sum of the values. If the cols attribute is set to 100%, 200% the browser displays two vertical frames with the second being twice as big as the first.

    Answer:

    This tag represents a piece of self-contained flow content. It is mostly used as a single unit as a reference the main flow of the document.

    Answer:

    The canvas element helps to build charts, graphs, bypass Photoshop to create 2D images and place them directly into HTML5 code.

    Answer:

    Two storage types of HTML5 are:

    Session Storage:

    It stores data of current session only. It means that the data stored in session storage clear automatically when the browser is closed.

    Local Storage:

    Local storage is another type of HTML5 Web Storage. In local storage, data is not deleted automatically when the current browser window is closed.

    Answer:

    The Application Cache concept means that a web application is cached. It can be accessible without the need for internet connection.

    Some advantages of Application Cache:

    1. Offline browsing – Web users can also use the application when they are offline.
    2. Speed – Cached resources load quicker
    3. Reduce the server load – The web browser will only download updated resources from the server.

    Answer:

    No, not all HTMLS tags come in pair. For e.g. <img>, <br>

    Answer:

    Some of the common lists that can be used are:

    a) Ordered list
    b) Unordered list
    c) Definition list
    d) Menu list
    e) Directory list

    Answer:

    - The browser collapses the multiple white spaces into a single white space in HTML.
    - This allows the developers to arrange the HTML code in a well organized and legible format.

    Answer:

    Yes, it is possible with the use of indents.

    Answer:

    No. The hyperlinks can be applied to both text as well as the images.
    - It means that even the images can become clickable links with a capability to take the visitor to the next page.
    - This can be done simply by using <a href> tag.

    Answer:

    Inline style takes priority over embedded style sheets.
    - Embedded style take priority over external style sheets.
    - If a single selector includes three different style definitions, the definition that is closest to the actual tag gets the priority.

    Answer:

    Here the property will be ignored without having any effect on the paragraph.

    Answer:

    Frames make it easier to navigate through a site.
    - The links that appear in the frame can appear through out the site.

    Answer:

    No. you can’t hide your source as it is required by the browser to display your document.

    Answer:

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

    Answer:

    ou can do it with the help of meta tag mentioned below:
     

    <META HTTP-EQUIV="Refresh" CONTENT="2"; URL="http://www.yourname.com">

    Place this tag between <HEAD></HEAD> .
    It will load yousite.com in 2 seconds.

    Answer:

    - This can be done by defining the frame with SCROLLING = auto and having content to just fit into this frame.
    SCROLLING="yes" gets the scroll bar on both the sides, even when not needed.
    SCROLLING="no" doesn’t get the scrollbars at all, even when they are needed.

    Answer:

    - .css file in the web page can be referred with the use of <link> tag.
    - It should be kept between <head></head> tag.
     

    <link href="/css/mystyle.css" type="text/css" rel="stylesheet" />
     

    Answer:

    - The better way to design the layout of the webpage is by using the <div> tag.
    - The <table> tag is used to present the data in tabular format.

    Answer:

    We can create nest table i.e. table inside a table.
    To create table we use following attributes:
     

    <table>……</table>: declare starting and ending of table.
    <tr>…</tr>: declare table row.
    <td>…</td>: table data.
    
    <table>
           <tr>
                 <td>first cell of the outer table</td>
                 <td>second cell of the outer table, creating second table inside the first table
                               <table>
                                      <tr>
                                               <td>first cell of the second table</td>
                                               <td>second cell of the second table</td>
                                      </tr>
                               </table>
                 </td>
           </tr>
    </table>
     

    Answer:

    - HTML elements with no content are called empty elements.
    For eg: <br>

    Answer:

    When we add many spaces in the content then HTML remove all space except one space this is Non Breaking Space. To overcome this problem we use '& nbsp;'(without space between & and nbsp;). Suppose we want to add 3 space between two words then we have to use & nbsp; three time.
     

    actual code:- hello I m Rohit Srivastava.
    Display as:- Hello I m Rohit Srivastava.
    But when we use & nbsp:
    Actual code:- Hello & nbsp; & nbsp ; & nbsp; I m Rohit Srivastava.
    Display as:- Hello I m Rohit Srivastava
    NOTE: (without space between & and nbsp;)
     

    Answer:

    We can link to a location in the middle of an HTML document. Using Following steps:
    1. Label the destination of the link : There are two ways of labeling destination using Anchor:
    NAME attribute:
     

    <h2><a name="destination">Destination: Explanation</a></h2>

    ID attribute:
     
    <h2 id="Destination_ID"> Destination: Explanation </h2>

    2. Link to the labeled destination : We can link with the destination in the same URL page and with Different URL page.
     
    Same URL: <a href="#Destination"> Visit to destination</a> or
    Different URL: <a href="thesis.html#section2">go to Section 2 of my thesis</a>
     

    Answer:

    Cell Padding : It refers to the gap or space between the cell content and cell border or cell wall.
    Cell Spacing : It refers to the gap between the two cells of same tables.

    In HTML cell spacing and padding both are used with Table Border layout.
     

    <table border cellpadding=2>
    <table border cellspacing=2>
    <table border cellpadding=2 cellspacing=2>
     

    Answer:

    To create buttons which act as a hyperlink, there are two ways:
     

    <FORM ACTION="[url]" METHOD=get>
    <INPUT TYPE=submit VALUE="Text on button">
    </FORM>
     
    <INPUT TYPE="submit" VALUE="Go to my link location"
    ONCLICK=" http://www.careerride.com/;" />
     

    Answer:

    The differences between HTML and XHTML are:

    1. HTML is application of Standard Generalized Markup Language(SGML) whereas XML is application of Extensible Markup Language(XML).
    2. HTML is a static Web Page whereas XHTML is dynamic Web Page.
    3. HTML allows programmer to perform changes in the tags and use attribute minimization whereas XHTML when user need a new markup tag then user can define it in this.
    4. HTML is about displaying information whereas XHTML is about describing the information.

    Answer:

    There are three ways to include the CSS with HTML:
    1. Inline CSS : It is used when only small context is to be styled.
    - To use inline styles add the style attribute in the relevant tag.
    2. External Style Sheet : Is used when the style is applied to many pages.
    - Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the head section:

    <head>
    <link rel="stylesheet" type="text/css" href="mystyle.css" />
    </head>
    3. Internal Style Sheet : Is used when a single document has a unique style.
    - Internal styles sheet needs to put in the head section of an HTML page, by using the <style> tag, like this:
    <head>
    <style type="text/css">
    hr {color:sienna}
    p {margin-left:20px}
    body {background-image:url("images/back40.gif")}
    </style>
    </head>
     

    Answer:

    - Logical tags are used to tell the meaning of the enclosed text. The example of the logical tag is <strong> </strong> tag. When we enclosed text in strong tag then it tell the browser that enclosed text is more important than other text.

    - Physical text are used to tell the browser that how to display the text enclosed in the physical tag.
    Some example of the physical tags are: <b>, <big>, <i>

    Answer:

    Yes, HTML supports JavaScripts. We can use JavaScript anywhere in the HTML Coding. Mainly there are four sections where we can add JavaScript in HTML.

    1. Head Section : We can add JavaScript in Head section of HTML.
    <head>…..Javascript…. </head>
    2. Body Section : <body>….. Javascript…</body>
    3. Head and Body both : We can add Javascript in both head and body section.
    <body….Javascript…</body> and <head>…..Javascript…. </head>
    4. External File : Script in and external file and then include in <head> ….. </head> section.

    Answer:

    Marquee tag : Marquee tag is used when we want that some text or content move in the web page whether horizontally or vertically.
     

    <marquee>move text</marquee>

    Attribute of Marquee tag are: bgcolor, direction, height, width, vspace etc.

    Answer:

    We can add midi Music in our HTML web page using following tag:
     

    <bgsound src="music.mid" loop="1">

    Attribute LOOP = 1 : Shows that music.mid is played only for one time. We can also set the value of loop to infinite. This tag is supported by Netscape and Internet Explorer.
     
    <embed src="canyon.mid" Autostart=TRUE Width=145 Height=60 Loop=true>
     

    Answer:

    Following are the New Media Elements are present in HTML5:

    1. <audio> tag : For playing audio.
    2. <video> tag : For playing video.
    3. <source> tag : For media resources for media elements.
    4. <embed> tag : For embedded content.
    5. <track> tag : For text tracks used in media players.

    Answer:

    In HTML we can list the element in two ways:

    1. Ordered list : In this list item are marked with numbers.

    <ol>
    <li> first item </li>
    <li>second item </li></ol>

    Display as:
    1. First item
    2. Second item.

    2. Unordered Lists : In this item are marked with bullets.
    <ul>
    <li> first item</li>
    <li>second item </li></ul>
    Display as:
    - First item
    - Second item.

    Answer:

    There are two types of background in HTML:

    1. Colored Background : In this the background of the html is colored.
     

    <body bgcolor = “red”>

    The value of the bgcolor can be set in three ways by hexadecimal number, an RGB value and Color name.
     
    <body bgcolor = “black”>
    <body bgcolor = “rgb(0,0,0)”>
    <body bgcolor = “#000000”>

    2. Image Background : In this we set the background of the website by an image. Syntax used for this is :
    <body background=”study.gif”>
     

    Answer:

    The differences between HTML and HTML5 are:

    1. Document of HTML is very large as compare to the HTML5.
    2. Audio and Video tags are not present in HTML whereas HTML5 contains audio and video tags.
    3. Vector technology is not integral part of HTML whereas HTML5 Vector technology is the integral part of it.
    4. HTML supported by all old browsers whereas HTML5 is supported by new browser.
    5. In HTML web sockets are not available whereas in HTML5 Full duplex communication channel is present.

    Answer:

    We can insert JavaScript in HTML using <Script tag>. JavaScript can be enclosed in <script type = text/javascript> and ending with </script>.
     

    <html>
      <body>
            <script type="text/javascript">
                   ...JavaScript….
            </script>
      </body>
    </html>
     

    Answer:

    SPAN : Used for the following things:

    1. Highlight the any color text
    2. For adding colored text
    3. For adding background image to text.
     

    <p>
    <span style="color:#000000;">
    In this page we use span.
    </span>
    </p>
     

    Answer:

    Website layout describes how the webpage of the website will look. It describes the content that has to be placed in columns i.e. it can be either one or many columns. There are two ways in which different layout can be created and these are called as using table method or using div method.

    There are basically two tags that are used <table> and <div>.
    <table> : Using this is the simplest way to create a layout.
     

    <html>
    <body>
    <table width="500" border="0">
    <tr>
    <td colspan="2" style="background-color:#FFA500;">
    <h1>Main Title</h1>
    </td>
    </tr>
    <tr>
    <td colspan="2" style="background-color:#FFA500;text-align:center;">
    This is my page</td>
    </tr>
    </table>
    </body>
    </html>

    <div> : It is used as a block element and is defined to group HTML elements together in one. The <div> tag is used to create multiple layouts.
     
    <html>
    <body>
    <div id="container" style="width:500px">
    <h1 style="margin-bottom:0;">Main Title of Web Page</h1></div>
    <b>Menu</b><br />
    </div>
    </body>
    </html>
     

    Answer:

    Doctype tag is not a HTML tag, it is just an instruction that is passed to the web browser to check for the information that is being provided by the markup language in which the page is written. Doctype is sometimes referred as Document type definition (DTD) that describes some rules that has to be followed while writing the markup language so to make the web browser understand the language and the content correctly. Doctype is very important to be placed in the beginning of the HTML and before the <HTML> tag to allow easy rendering of the pages that are used.

    Answer:

    Doctype helps the web browser to correctly render the web pages. There are different types of Doctype that are available and they are as follows:

    1. Strict Doctype : It consists of all the HTML elements and it is also known as DTD (Document type definition) but it doesn't include the presentational and deprecated elements i.e. font, center, etc. Framesets related elements are also not allowed in this.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

    2. Transitional Doctype : It consists of all the HTML elements and attributes. It is also known as DTD (Document type definition). It includes the presentational and deprecated elements i.e. font, center, etc. Framesets related elements are also not allowed in this.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

    3. Frameset Doctype : It consists of all the HTML elements and attributes. It is also known as DTD (Document type definition). It includes the presentational and deprecated elements i.e. font, center, etc. Framesets related elements are also allowed in this.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
     

    Answer:

    Metadata is the data about the data or the information about the data. There is a tag <meta> that is being provided for the HTML document. This information won't be displayed anywhere and will not be visible to the user. It will be parsable by the machine which will parse it according to the requirement. It consists of the elements that are related to the page description, keywords, document related element. The tag that is being used resides in the <head> section in HTML. The meta information is being used by the web browser or by the search engines to rank and let the user find the pages easily.
     

    <meta name="description" content="Here you will get everything" />
     

    Answer:

    The different types of entities that are present in HTML are < (less than) or > (greater then). It allows the special or the reserved characters are matched with the source code and then it is saved.
     

    &entity_name;
    OR
    &#entity_number;

    There is always a concept associated with it that will create more simpler provision to avoid the spaces that are being coming in between the characters or the text.

    Answer:

    URL stands for Uniform Resource locater. This helps just like the Internet pooling concept where the people recognize themselves and others people connected together with each other. URL allows a document to be located on World Wide Web (www).
     

    scheme://host.domain:port/path/filename

    This code has got with no meaning but there are some elements that are defined:

    scheme - Is the type of internet service. In this HTTP can be used which has to most common type.
    Host – It is used to control the host name and fetch the information from other templates as well.
    Domain – It defines the internet domain that is google.com.
    :port – It defines the port number on the Host where the default port that is being used is 80.
    path – This defines the path of the server that consists of a hierarchical directory structure.
    filename - It defines the unique name for the file or the document that saves it.

    Answer:

    A helper application is a program that is used in the browser to help the users with lots of information that is not being provided with the applications. These helper application is known as Plug-ins. Helper application includes audio, video, etc. The tag that is used to embed is <object>. Helper application allows easy incorporation of audio and video that is controlled by the user. Helper application allow the control over the volume setting and other functions like play, stop,etc.
     

    <object width="420" height="360" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.career.com/qtplugin.cab">
    <param name="src" value="hello.wav"/>
    <param name="controller" value="true"/>
    </object>
     

    Answer:

    Canvas is an element that is used for the graphics for the web page. It uses JavaScript to bring the graphics functionality live. It allows easy way to draw the graphics and use different types of tools to create drawing on the web page. Canvas is just a rectangular area that controls the pixel of every element that is used in the web page. Canvas uses methods like paths, circles, etc.
     

    <canvas id="can" width="200" height="100"></canvas>

    The canvas element includes id, width and height settings and with the javascript it gets used like:
     
    <script type="text/javascript">
    var c=document.getElementById("can");
    var ctx=c.getContext("2d");
    ctx.fillStyle="#FF0000";
    ctx.fillRect(0,0,150,75);
    </script>
     

    Answer:

    Iframe is called as inline frame that places one HTML document in a frame. It is different from the object element as the inline frame can be made in the target frame. The target frame consists of the links that is defined by other elements used in the web page. Iframe is used to focus on printing or viewing of the source. Iframe can be used by the user in those browser that supports it. If they have used iframe also then the incompatible browser won't display the actual but display of the alternative text will take place. The content of the iframe is being written in between <iframe>.........</iframe>.
     

    <iframe src="http://www.abc.com"></iframe>
     

    Answer:

    Frames allow the display of the document visually. It allows the window to be split into segments that can contain multiple different documents. It can utilize many resources and repeat some parts of the layout that can be used in a frame.

    Frames consists of different types of tags and they are as follows:

    1. <frameset>...</frameset> : It consists of the frames that includes the layout using the attributes of rows and cols.
    2. <frame> or <frame/> : It consists of a single frame and gets included within the frameset. It is always come up with a src attribute that provides the source that has to be shown in a particular frame.
    3. <noframes>...</noframes> : It consists of the normal HTML content that is used to show no frames.
    4. <iframe>...</iframe> : It consists of internal frame that will contain the src attribute to include the frame that is internal to a particular region.

    Answer:

    To change the color of the background of the body or the text there is a <body> tag that has to be included where there are some elements that has to be used to set the properties of it.
    The code is as follows:
     

    <html>
    <head>
    </head>
    <BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#ffff00">
    </body>
    </html>

    he elements that are used in this tag is as follows:

    1. BGCOLOR : Represents the background color which will be applied totally on the body if there is no other bgcolor used with any other tag internally.
    2. TEXT : Represents the color of the text that will be applied to the complete text present in the body.
    3. LINK : Represents the color of all the text links that are present inside the body.
    4. VLINK : Represents the color of the links that has already been visited.
    5. ALINK : Represents the color of the text links that will change when the page accessed will be active.

    Answer:

    Tables can be made nested by making it come in another table. This consists of many attributes and tags that can be used in nesting the tables.

    The tags that are used for the table is as follows:

    <TR> : This is the tag that has to be written after the <table> tag and before any other tags. This makes a table row that store the data elements.
    <TD> : This tag can be used anywhere and it consists of the data that has to come on the website.
    <TH> : This tag consists of the table heading.

    The sample code will explain the above explanation much better:

    <table>
    <tr>
    <td>this is the first cell</td>
    <td>this is the second cell
    <table> <!--Starting of the table that is embedded inside another table-->
    <tr>
    <td>this is the first cell second table</td>
    <td>this is the second cell of second table</td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
     

    Answer:

    A form can consist of the table and its properties to display it on the web page. The form is placed with the <td> tag that includes the data of the table. This can also be used to position the form in relation to the other content. The table will be added within the form.
     

    <FORM ACTION="[URL]">
    <TABLE>
    <TR>
    <TH>This is the table heading</TH>
    <TD><INPUT TYPE="text" NAME="account"></TD>
    </TR>
    <TR>
    <TH>This is another heading for a button</TH>
    <TD><INPUT TYPE="password" NAME="password"></TD>
    </TR>
    <TR>
    <TD> </TD>
    <TD><INPUT TYPE="submit" NAME="Log On"></TD>
    </TR>
    </TABLE>
    </FORM>

    In this the form elements are getting used inside the table tags like <input type>, <text area>, etc. The form input will be given using the <td> tag that displays the table data and related information accordingly.

    Answer:

    The presentation is being done by CSS that is used with the HTML, to give the style to the HTML content. This is called as style sheet. The links can be specified in different colors by the following way:
     

    a:link {color: blue; background: white}
    a:visited {color: purple; background: white}
    a:active {color: red; background: white}

    This is the CSS properties that is being defined to set the color for the links that are active, visited and normal link. User can use the class attribute in the tags like <a> to use it and see the change in the link color. It is shown as:
     
    <a class="exp" href="[URL]">example of the link</a>

    The style sheet can be modified according to the code that is being written. The coding will include:
     
    a.exp:link {color: yellow; background: black}
    a.exp:visited {color: white; background: black}
    a.exp:active {color: red; background: black}
     

    Answer:

    The uploading of files requires some necessary configuration like :An HTTP server that acts as a transaction between the user and the server. Access to the directory of cgi-bin that consists of the receiving script.

    There are some scripts that are already available. Form for the implementation and the coding of it will be like:
     

    <form method="post" enctype="multipart/form-data" action="up.cgi">
    The form that has to be uploaded will be done by the following given code:
    <input type=file name=upload><br>
    This tag will contain the file name that has to be uploaded on the website.
    Any remarks about the file will be written like:
    <input type=text name=remark><br>
    <input type=submit value=Press> This form will allow user to upload their own file in an easy way.
    </form>
     

    Answer:

    Custom button can be given just by putting the image with the button or by using any other button then normal. Usually the button is being made by the <input> tag like:
     

    <input type= “submit” value= submit>
    An image can be used for the custom button as an input type like:
     
    <input type = ”image” value = submit>

    The input in the image format defines the graphical button that has to be placed in the form of submit on the web site. Image input type return the x-y coordinates rather than the normal text as a value. The attributes of Value and Alt will be used to set the name value attribute. The example for the same will be given as:
     
    <input type="image" name="submit" alt="submit" value="submit" src="submit.jpg">
     

    Answer:

    Getting framed refers to the document that is being displayed in someone else's frameset in your HTML. This will be password protected and the permissions has to be taken before inserting the frameset. The framing of the document can be avoided by using TARGET=_top applied to all the links that will lead to the document that are outside the scope of a particular user without permission. A javaScript can be used that will automatically handle the request to remove the existing framesets. This can be given as:
     

    if (top.frames.length!=0)
    {
        if (window.location.href.replace)
           top.location.replace(self.location.href);
        else
           top.location.href=self.document.href;
    }
    
     

    Answer:

    One frameset can be defined inside another frameset if the accessing permission are provided directly. The frameset can be stored by using the JavaScript in the document that is being written by the user and the script is as follows:
     

    if (parent.location.href == self.location.href)
    {
        if (window.location.href.replace)
           window.location.replace('frame.html');
        else
           // causes problems with back button, but works
           window.location.href = 'frame.html';
    }

    The anchor <a> tag is used to link the frameset that can be used to restore the frames that has been stored.
    <A HREF="frameset.html" TARGET="_top">Restore the frame
    There is always a separate frameset document written for every content document. The frameset documents are generated automatically. The content document can be linked separately rather than linking them together.

    Answer:

    To update the two frames at the same time there is a requirement for the HTML based techniques that links the documents with a new frameset document. It specifies a new frames that can be combined with other frames. There is a JavaScript that will be used to link the updated frame and the method that will be used is onClick(). HTML based technique allow the new frameset document with the attribute of TARGET=_top. In this the first frameset document uses a secondary frameset document that will be defined as the nested frameset. The following code explains it further:
     

    <frameset cols="*,3*">
    <frame src="first.html" name="first_frameset">
    <frame src="second.html" name="sec_frameset">
    <noframes>
    </body></noframes>
    </frameset>

    The link that is given in the TARGET= “sec_frameset” attribute it replaces all the frames that is defined as second.html.

    Answer:

    Some of the new features provided in HTML5 are:

    1. It provides support for local storage
    2. New form controls, like calendar, date, time, email, url, search
    3. <canvas> element is provided to facilitate 2D drawing
    4. The <video> and <audio> elements are provided for media playback
    5. New content-specific elements are provided. For e.g. <article>, <header>, <footer>, <nav>, <section>

    Answer:

    <audio> and <video> elements are provided by HTML5 for media playback.
    The tags used are:
    1) <audio> - It defines sound content.
    2) <video> - It defines a video or a movie.
    3) <source> - This tag defines the multiple media resources for <video> and <audio>.
    4) <embed> - It provides a container for an external application or interactive content.
    5) <track> - It defines text tracks for <video> and <audio>.

    Answer:

    The new Form elements in HTML5 provide for a better functionality. The tags provided to carry out these functions are:

    1) <datalist> - It specifies a list of options for input controls. These options are pre-defined.
    2) <keygen> - This tag defines a key-pair generator field.
    3) <output> - It defines the result of a calculation.

    Answer:

    The various tags provided for better structuring in HTML 5 are:

    1) <article> - This tag defines an article.
    2) <aside> - It defines content other than the page content.
    3) <bdi> - This tag isolates a part of text for formatting in a different direction from other text.
    4) <command> - It defines a command button to be invoked by the user.
    5) <details> - It defines additional details that can be viewed or hidden by the user.
    6) <dialog> - It defines a dialog box.
    7) <figure> - This tag specifies content like illustrations, diagrams, photos, code listings, etc.
    8) <figcaption> - It is used to provide a caption for a <figure> element
    9) <footer> - This tag defines a footer for a document or section
    10) <header> - This tag is used to define a header for a document or section
    11) <hgroup> - When there are multiple levels in a heading, it groups a set of <h1> to <h6> elements.

    Answer:

    1) <mark> - It defines highlighted text.
    2) <meter> - It defines a scalar measurement within a known range.
    3) <nav> - It defines links for navigation.
    4) <progress> - This tag exhibits the progress of a task.
    5) <ruby> - It defines a ruby annotation for East Asian typography.
    6) <rt> - It defines an explanation/pronunciation of characters for East Asian typography.
    7) <rp> - This tag tells the system what to display in browsers that do not support ruby annotations.
    8) <section> - It defines a section in a document.
    9) <summary> - It provides a visible heading for a <details> element.
    10) <time> - This tag defines a date/time.
    11) <wbr> - This tag defines a line-break.

    Answer:

    Following elements of HTML 4.01 are no more a part of HTML 5:

    <acronym>
    <applet>
    <basefont>
    <big>
    <center>
    <dir>
    <font>
    <frame>
    <frameset>
    <noframes>
    <strike>
    <tt>
     

    Answer:

    1. SVG is the abbreviation for Scalable Vector Graphics and is recommended by W3C.
    2. It is used to define vector-based graphics for the Web.
    3. The graphics are defined in XML format.
    4. An important quality of SVG graphics is that their quality is maintained even when they are zoomed or resized.
    5. All the element and attributes of SVG files can be animated.

    Answer:

    Following are the main advantages of using SVG over other image formats:

    - It is possible to scale the SVG images.
    - They can be created and edited with any text editor.
    - The print quality of these image is high at any resolution.
    - It is possible to zoom the SVG images without any degradation in the quality.
    - SVG images can be searched, indexed, scripted, and compressed.

    Answer:

    The table below shows some important differences between Canvas and SVG:

    - Canvas is resolution dependent while SVG is not.
    - Canvas does not provide any support for event handlers while SVG does.
    - Canvas is suitable for graphic-intensive games while SVG is not suitable for gaming.
    - Canvas is suitable for small rendering areas while SVG is suitable for large rendering areas like Google maps.

    Answer:

    - Canvas is a rectangular area on a HTML page, specified with the tag <canvas>.
    - By default, a canvas has no border. To get a border on the canvas, a style attribute is required to be used.

    Answer:

    Following methods are used to draw a straight line on a Canvas:

    1. moveTo(x,y) – It defines the starting co-ordinates of the line.
    2. lineTo(x,y) – It defines the ending co-ordinates of the line.
    3. The actual line is drawn with the help of a method like stroke()

    Answer:

    Gradients in canvas are used to fill rectangles, circles, lines etc.
    The gradients in Canvas are of two types:

    1. createLinearGradient(x,y,x1,y1) – It creates a linear gradient
    2. createRadialGradient(x,y,r,x1,y1,r1) – It creates a radial/circular gradient

    Answer:

    drawImage(image,x,y) method is used to draw an image on the canvas.

    Answer:

    To make an image draggable, the draggable attribute is set to true:

    <img draggable="true">
     

    Answer:

    - Yes, HTML5 can get the location of a user with the use of Geolocation API.
    - Use getCurrentPosition() method to get the user’s current position.

    Answer:

    HTML5 provides following audio tags:

    <audio> - Defines sound content
    <source> - Defines multiple media resources for media elements, such as <video> and <audio>

    Answer:

    Following are the important, new input types for forms provided by HTML 5:

    1. color – Used for fields that should contain colour.
    2. date – Allows the user to select a date.
    3. datetime - Allows the user to select a date and time (with time zone).
    4. datetime-local - Allows the user to select a date and time (without time zone).
    5. email - Used for input fields that should contain an e-mail address.
    6. month - Allows the user to select a month and year.
    7. number - Used for input fields that should contain a numeric value. Restrictions on type of numbers accepted can be set.
    8. range - Used for input fields that should contain a value from a range of numbers. Restrictions on type of numbers accepted can be set here as well.
    9. search - Used for search fields.
    10. tel - Defines a field for entering a telephone number.
    11. time - Allows the user to select a time.
    12. url - Used for input fields that should contain a URL address.
    13. week - Allows the user to select a week and year.

    Answer:

    With HTML5, it is possible for the web pages to store the data locally in the user's browser. This web storage is much faster and secured than the cookies. Also, a larger amount of data can be stored without causing any adverse effect to the performance of the website.

    The data here is not included with every server request. It is used ONLY when it is asked for. It is only that particular web page that can access the data stored by itself.

    Answer:

    localStorage object stores the data without an expiry date while sessionStorage object stores the data only for one session.
    - With localStorage object, data will not be deleted when the browser window is closed while the data is deleted when the browser window closes with sessionStorage objects.

    Answer:

    The Application Cache concept introduced by HTML5 means that a web application is cached, and accessible without an internet connection.

    There are three advantages of Application Cache:

    1. Offline browsing - Users can use the application when they're offline
    2. Speed - Cached resources load faster
    3. Reduced server load - The browser will only download updated/changed resources from the server

    Answer:

    A Manifest file is a simple text file that tells the browser what to cache and what not to cache.

    There are three sections of a Manifest file:

    1) CACHE MANIFEST - Files listed here are cached after they are downloaded for the first time.
    2) NETWORK - Files listed here require a connection to the server, and are never cached.
    3) FALLBACK - Files listed here specify fallback pages if a page is inaccessible.

    Answer:

    1. A web worker is a JavaScript which runs in the background. It exists in external files.
    2. It is independent of other scripts and does not affect the performance of the page.
    3. Web workers are usually used for CPU intensive tasks.

    Answer:

    Following JavaScript objects are not accessible to web worker:

    1. The window object
    2. The document object
    3. The parent object

    Answer:

    The new attributes provided in HTML5 for <form> are:

    1) autocomplete
    – It specifies if a form or input field should have autocomplete as on or off.
    – If autocomplete is on, the browser is able to fill the values based on the values filled by the user earlier.
    – autocomplete works for following input types: text, search, url, tel, email, password, datepickers, range, and color.

    2) novalidate
    - This is a boolean attribute.
    - When present, it signifies that the form-data should not be validated when submitted.

    Answer:

    Following are the new attributes provided in HTML5 for <input>

    1) autofocus:
    - This is a Boolean attribute.
    - When present, it means that an <input> element should automatically get focus when the page is loaded.

    2) form:
    - This attribute specifies one or more forms an <input> element belongs to.

    3) formaction:
    - This attribute specifies the URL of a file that will process the input control when the form is submitted.
    - This attribute is used with type="submit" and type="image".
    - It overrides the action attribute of the <form> element.

    4) formenctype:
    - This attribute specifies how the form-data should be encoded when submitting it to the server.
    - It is used with type="submit" and type="image".
    - It overrides the enctype attribute of the <form> element.

    5) formmethod:
    - It defines the HTTP method for sending form-data to the action URL.
    - It is used with type="submit" and type="image".
    - It overrides the method attribute of the <form> element.

    6) formnovalidate:
    - It is a boolean attribute.
    - It specifies that the <input> element should not be validated when submitted.
    - It is used with type="submit".
    - It overrides the novalidate attribute of the <form> element.

    7) formtarget:
    - It specifies a name or a keyword that indicates where to display the response that is received after submitting the form.
    - It is used with type="submit" and type="image".

    8) height and width:
    - It specifies the height and width of an <input> element.
    - It is used only with <input type="image">

    9) list:
    - It refers to a <datalist> element which contains pre-defined options for an <input> element.

    10) min and max:
    - It specifies the minimum and maximum value for an <input> element.
    - It works with the following input types: number, range, date, datetime, datetime-local, month, time and week.

    11) Multiple:
    - It is a boolean attribute.
    - It specifies that the user is allowed to enter more than one value in the <input> element.
    - It works with the following input types: email and file.

    12) pattern:
    - It specifies a regular expression that the <input> element's value is checked against.
    - It works with the following input types: text, search, url, tel, email, and password.

    13) placeholder:
    - It specifies a short hint that describes the expected value of an input field.
    - It works with the following input types: text, search, url, tel, email, and password.

    14) required:
    - It is a boolean attribute.
    - It specifies that an input field must be filled out before submitting the form.

    15) step:
    - It specifies the legal number intervals for an <input> element.
    - It works with the following input types: number, range, date, datetime, datetime-local, month, time and week.