HTML Interview Questions
HTML is short for HyperText Markup Language, and is the language of the World Wide Web. It is the standard text formatting language used for creating and displaying pages on the Web. HTML documents are made up of two things: the content and the tags that formats it for proper display on pages.
Content is placed in between HTML tags in order to properly format it. It makes use of the less than symbol (<) and the greater than symbol (>). A slash symbol is also used as a closing tag. For example:
<strong> sample </strong>
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.
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.
White spaces are blank sequence of space characters, which is actually treated as a single space character in html. Because the browser collapses multiple space 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.
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.
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.
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 web site.
When you use image maps, it can easily become confusing and difficult to determine which hotspots corresponds with which links. Using alternative text lets you put a descriptive text on each hotspot link.
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.
<a>tag can accept only a single href attribute, and it can point to only a single web page.
A marquee allows you to put a scrolling text in a web page. To do this, place whatever text you want to appear scrolling within the <marquee> and </marquee> tags.
No. The <br> tag is only one way to separate lines of text. Other tags, like the <p> tag and <blockquote> tag, also separate sections of text.
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.
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.
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>
1. First item
2. Second item.
2. Unordered Lists : In this item are marked with bullets.
<ol> <li> first item </li> <li>second item </li></ol>
- First item
- Second item.
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>
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.
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 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" />
The canvas element will be used as follows:
<canvas id="can" width="200" height="100"></canvas>
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.
<iframe> ----- </iframe>
"pre" tag defines the pre-formatted text that is used to display the text with the fixed width and uses a predefined fonts and it keeps both spaces and line breaks separate and show the text as it is.
The code that can be used to display the text that can be written in whatever way the user wants is as follows:
<pre> Text in a pre element ----// is displayed in a fixed-width font, and it preserves both spaces and line breaks </pre>
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.
<table> <tr> <td>this is the first cell</td> <td>this is the second cell</td> <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>
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
<b> </b>tag is not used for bold statement as well as
<i> </i>tag is used for italic. Instead of these we use
Marquee is used to put the scrolling text on a web page. You should put the text which you want to scroll within the
Following is a list of 10 important new elements in HTML 5:
No. Almost all browsers (updated versions) support HTML 5. For example: Chrome, Firefox, Opera, Safari, IE etc.
The progress tag is used to represent the progress of the task only while the meter tag is used to measure data within a given range.
The button tag is used in HTML 5. It is used to create a clickable button within HTML form on the web page. It is generally used to create a "submit" or "reset" button.