Skip to main content

30 html interview questions and answers

1. Do all HTML tags come in pair?

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

2. What are some of the common lists that can be used when designing a page?

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
HTML5 interview questions and answers

3. What is the advantage of collapsing white space?

- 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.

4. Is it possible to list elements straight in an html file?

- Yes, it is possible with the use of indents.

5. Does a hyperlink apply only to text?

- 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.

6. What hierarchy is being followed when in style sheets?

- 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.

7. What happens if the list-style-type property is used on a non-list element like a paragraph?

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

8. What is the advantage of using frames?

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

9. How can I hide my source?

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

10. How will you align a table to the right or left?

- 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">

11. Why doesn't <TABLE WIDTH="100%"> use the full browser width?

- This is because the graphical browser is designed to leave a margin between the display area and actual content.
- The navigator also leaves some space for the scroll bar on the right side of the display area. Though, if the page is not long enough, the scroll bar doesn’t appear.

12. How would you automatically transfer your visitors to a new web page?

- You 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.

13. You want only a vertical scrollbar and no horizontal scrollbar on your page. How would you do it?

- 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.

14. How do you refer to the .css file in the web page?

- .css file in the web page can be referred with the use of <link> tag.
- It should be kept between <head></head> tag.
- Eg. <link href="/css/mystyle.css" type="text/css" rel="stylesheet" />

15. What is a better way to design the layout of a web page – a table tag or div?

- 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.

16. What is a <dl> tag in HTML?

- <dl> is a definition list tag used in HTML.
- It is used with <dt> and <dd>.
- <dt> list the item while <dd> describes it.

17. What are empty HTML elements?

- HTML elements with no content are called empty elements.
- For eg. <br>
HTML interview questions and answers - contributed by Rohit Srivastava

How to create nest tables within tables in HTML?

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>

Explain Non Breaking space in HTML.

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”. Suppose we want to add 3 space between two words then we have to use &nbp three time.

Example:

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

How do I link to a location in the middle of an HTML document?

We can link to a location in the middle of an HTML document. Using Following steps:
  • Label the destination of the link. There are two ways of labeling destination using Anchor:
    o NAME attribute:
    Example: <h2><a name="destination">Destination: Explanation</a></h2>
    o ID attribute:
    Example: <h2 id="Destination_ID"> Destination: Explanation </h2>
  • Link to the labeled destination: we can link with the destination in the same URL page and with Different URL page.
    Example:
    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>

Explain Cell Padding and Cell Spacing.

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.

Example:

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

How to create a button which acts like a link?

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/;" />

What is difference between HTML and XHTML?

The differences between HTML and XHTML are:
  • HTML is application of Standard Generalized Markup Language(SGML) whereas XML is application of Extensible Markup Language(XML).
  • HTML is a static Web Page whereas XHTML is dynamic Web Page.
  • 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.
  • HTML is about displaying information whereas XHTML is about describing the information

Comments

Popular posts from this blog

anchor suma photo gallery,suma photos

priyamani hot and sexy photos , Priyamani wallpapers

 Priyamani hot and sexy photos  Priyamani Images

actress Swathi photo stills