HTML

HTML Projects

HTML Project

HTML Subjective Questions And Answers

More interview questions and answers

Write some useful table tags that we use in HTML?

 I have display the list of some tags that we used in HTML table.These tags are:

<table>  This is started tag of table.All other table tags works inside this tag.
<th>     This is used to write header on table.
<tr>     This is used to create row on table.
<td>     This is used to create table cells.
<caption>This is specifies the table caption.
<colgroup>Specifies the group of columns in table.
<col>    Using then we can set the attribute value
         for one or more columns in table.
<thead>  This is used to set table head.
<tbody>  This is used to set table body.
<tfoot>  This is used to set table border.

How you define HTML Frames?

 Using HTML Frames we can show more than one HTML document on the same browser.Where as each HTML document is called Frame. We use Frames using <frameset> tag.

It is used to divide windows into frames. Using frame tag we put HTML document into the each frame.

Example:

<frameset cols=\"25%,75%\">
   <frame src=\"frame_first.htm\">
   <frame src=\"frame_second.htm\">
</frameset>

 25% and 75% specifies the width of the page.Above frame told that frame_first aquire the 25% area on the web browser and frame_second aquire the 75% area on the same same web browser.
 

Can we write a comment into the HTML?

Yes,HTML provide us facility to write comments on HTML file.Comments that we write on HTML file are ignored by the browser so it will not display on browser.

Syntax:
<!-- Here write your comment -->

Example:
<html>
<body>
<!--Which you here not will displayed on browser-->
<p>R4R Welcomes You!</p>
</body>
</html>

Output:

R4R Welcomes You!

WHAT is the HTML?

HTML stands for Hyper Text Markup Language.It is a markup language which is use to develop web pages. Using them we can describe our document into the form of text based information.For achieving that goals it has many tags like title,head,paragraph, table etc.

In HTML we write tags surrounded with angle brackets.We can you some scripting language like JavaScript to display HTML doc in more attractive way.

 Some main features of HTML are given below:

1.It is markup language.
2.It has provided pre-defined tags.
3.We save HTML file by using one of two extensions .htm or .html.
4.It uses markup tags to display on web page

What do you know about HTML tags?

 HTML tags decided how HTML file is look like on web page.I have given you some basic information about HTML tags.
1.In HTML,every keyword should be surrounded with open and closed with angled brackets.
Example:<html>,<body>,<title>,<head> etc.
2.HTML tags are not case sensitive means that suppose if we open <html> tags than we can closed this tag with <html>.
3.When we open an HTML tag it should we have to closed tag.Like: <a>....</a>
4.In the above point tag (<a>) is called the open tag.where as tag</a> is called the end tag.

Example:

<head>
<body>
.....
.....
</body>
</head>

What are basic HTML tags how we use them?

 I have shown you some basic HTML tags with their example:

1.Heading<h1...h6>:Range of HTML headings is from h1 to h6.When we go h1 to h6 its headings become larger and bold.

Example:
<h1>Write HTML heading between those tags</h1>
<h2>Write HTML heading between those tags</h2>
........
........
<h6>Write HTML heading between those tags</h6>

2.Paragraph<p>...</p>:We write paragraph in HTML by using <p>.....</p> tag.

Example:<p>Write here a paragraph</p>
3.Link Using this we can link our HTML file with some other files.

Example:
<a href=\"http://www.R4R.co.in\"></a>

4.Image It is used to describe the image in HTML.

Example:
<img src=\"welcome.gif\" width=\"200\" height=\"75\" />

How you define elements in HTML?

Basically HTML element are those who define the structure of HTML document.It is used to arrange the content of HTML is an appropriate manner. Element may be of headings, links, paragraphs and structures etc.
When you want to create any HTML element than keep these points in mind.

1.Element should open with the start tag.
2.After that can include attributes with their values.Like: name=\"Abhi\"
3.Than you write content.Like:This is our first HTML page.
4.and close with end tag.(but is optional when you want to create an empty element than their is no need to close your open tag)In HTML your content may be empty.

Example:

<p  name=\"Abhi\">My first HTML page</p>

Open  Attribute(name)     Content       End

What is Empty HTML element?

 When HTML element does not have any content.Than those element are called as Empty element.Empty element does not have any end tag.

Example:
<br /> (It is an empty element which is used to break line.)

Because it is an empty element than their is no need to close them.

To use empty element is only on HTML.Because in XHTML,XML and new versions of HTML does have provided this types of element.
  

How you define list in HTML?

In HTML we can create ordered,unordered and definition list.

Ordered List: Ordered list define as list of items and they are fully numbered.Our ordered list start with

Example:

 <ol>
   <li>Abhi</li>
   <li> Vivek</li><li>
   <li> John</li>
</ol>

Unordered list define as list of items and they are write with small black circles.Our ordered list start with

Example:
   <ul>
         <li>Abhi</li>
         <li>Vivek</li>
          <li>John</li>
   </ul>


Definition List: It is not only a list of items. In create list of item with their description. Description list start with <ud> tag and end with </ud></li>
 

How to link the Images with in HTML?

 I have given you syntax how to set images on HTML document.

Syntax:

<html>
<body>
<p>
An image:<img src=\"r4rlogo.gif\"width=\"140\" height=\"40\">
</p>
<p>
Using this link you can see the logo of r4r.</p>
</body>
</html>

How we define Src Attribute and Alt Attribute in HTML?

We use src Attribute and Alt Attribute with the image tag(<img>). Image tag is an empty tag.So, their is no need to close img tag. we use src(stands for source) for load the image on the HTML page.

Syntax: <img src=\"write here the address or location of image\" />

We use Alt Attribute to define the image which you loaded with src Attribute

Syntax:<img src=\"image.gif\" alt=\"Description of image\"/>Example:<img src=\"logo.gif\" alt=\"R4R logo\"/>
Some image tags are given below:
<map> It is used to define image map.
<img> It is used to define an image.
<area>Using this we can create the area.Those area we want show as click-able.

How to create tables in HTML?

We use <table> tag to create the table in HTML. After creating an table we use <tr> tag to create the rows.And use <td> to create data cell on each row.These cell can store images,text,tables,list etc.
 
Basic syntax to create an Table are given below:


<table border=\"1\">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
<td>row 1, cell 3</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
<td>row 2, cell 3</td>
</tr>
</table>

How to create headings and empty cells in table?

Any thing that we write b/w <th>.....</th> tag are display as table heading.

Example
<table border=\"1\">

<tr><th>Heading of column 1</th>
<th>Heading of column 2</th>
<th>Heading of column 3</th>
</tr>
<tr><td>row 1, cell 1</td>
<td>row 1, cell 2</td>
<td>row 1, cell 3</td>
</tr>
</table>


Than table will generated on web browser looks like,Heading of column 1   Heading of column 2row 1, cell 1
 row 1, cell 2, cell 3.

We can create an empty cell with in table like that:-

<table border=\"1\">
<tr><td>row 1, cell 1</td>
<td>row 1, cell 2</td></tr>
<tr><td>row 2, cell 1</td><td></td></tr>
<tr><td></td><td>row 3, cell 2</td></tr>
</table>

Now, than our HTML table looks like,row 1, cell 1 row 1, cell 2row 2, cell 1  row 3, cell 2 .If your does not show the border line around empty cell than you can write (called space) between the tags of empty cells.

Like:<td>&nbsp;</td>

 

How you define HTML link?

Using the HTML link we can  addressed the page, document or file on the web browser.I have given you example how to link the HTML page.

Example:
<html>
<body>
<p>

R4R Welcomes You!
You are on the right place.Definitely your queries will gone when you proper visit that site.

</p>
</body>
</html>

save this page with welcome.htm

<html>
<body>
<p>
<a href=\"welcome.htm\">Home</a>
</p>
</body>
</html>

What are the Hyperlink,Anchors and Link in the HTML?

Using Hyperlink we can address the page or file on the web browser.These are may be of image, sound or movie file etc.
Using Anchors we can define the hyperlink destination inside a document.We use <a> tag to define the hyperlinks and anchors.

How you define href,target and name Attributes?

 href Attribute is used to address the page and document on the web page.

Syntax:
<a href=\"http://www.r4r.co.in/\">see R4R</a>


 target Attributes are used to told about that where the document will open those linked.

<a href=\"http://www.r4r.co.in/\" target=\"_blank\">see R4R</a>

 name Attribute is used to set the anchor name in the HTMl document.

We named Anchor like that

<a name=\"label\">Write content here</a>

We can linked the named anchor like that

<a href=\"#label\">Write content here</a>

How you define HTML Attribute Reference?

 I have given you some Attribute with their description.These are.

style :This attribute use to style inline,rules to an element.

Syntax:<a style=\"value>.......</a>

bgcolor
:This is use to set background color.

Syntax:<a bgcolor=\"value\">....</a>

we use color values in Hexadecimal code.

href :This is used for the linking.

Syntax:<a href=\"home.html\">.......</a>

size:This is used to set the font size.

Syntax:<a size=\"value\">.......</a>

title:Those I wrote on this display on tooltip.

Syntax:
<a title=\"value\">.......</a>

How you define HTML Style Attribute in HTML?

 We use Style Attribute in HTML how the text look like in HTML.Using Style we can implement the CSS in HTML.
 I have given you some examples which show use of Style in HTML.

1.style=\"background-color:red\"
2.style=\"font-size:15px\"
3.style=\"font-family:verdana\"
4.style=\"text-align:left\"

Example:
<html>
<body style=\"background-color:yellow;\">
<h1>Style Attribue</h1>
<p style=\"font-family:verdana;color:green\">
This is my first HTML page where I use style attribute</p>
</body>
</html>

What are the Deprecated Tags and Attributes?

 Basically Depreciated Tags and Attributes are those that are only used in HTML.Means they are old Tags and Attributes that are not supported in the new versions of HTML,Like:XHTML.Because those are not used in future than we should have to avoid the use of them.

 I have given you list of these Depreciated Tags and Attributes are given below:
List of  Deprecated Attributes are:

color   This is used to set the text color.
align   This is used for Horizontal alignment of the table and frames with the value center,left and right.
bgcolor This is  used to set background color.

List of Deprecated Tags are:
<u>           This is used to underlined the text.
<font>       This is used to set HTML font.
<strikeout>This is used to strikeout the text.
<center>   This is used to centered the content.

How you define Attributes in HTML?

 Using Attributes we can give us more information about HTML elements.Many times in HTML we use Attributes with their associated value. For assigning the value to attributes we use\'=\'operator.

 In an one HTML element can have many attributes.We use Attributes with in start tag of HTML.
 Below I have given you some attributes with their values.

style=\"color:red;\"
border=\"1\"
href=\"http://www.r4r.co.in\"
title=\"This is our first HTML page.\"

I have given a example.How to use above three attributes together.

Example:
<p border=\"1\" href=\"http://www.r4r.co.in\" style=\"color:red;\" title = \"This is our first HTML page.\"></p>

How to use Line Break and Horizontal Line tags in HTML?

In HTML we use <br /> to break the line without started any new paragraph.
Syntax:
<br />
 In HTML <br /> has no end tag.

Example:
<p>Hello<br />client<br />R4R Welcomes You!</p>
Output:
Hello
client
R4R Welcomes You!

 For creating horizontal line we use <hr /> in HTML.
Syntax:
<hr />
Example:
<p>This is upper level</p>
<hr />
<p>This is middle level</p>
<hr />
<p>This is bottom level</p>
 Both <br /> and <hr /> called as empty tags. Because their is no end tag for them.

How you achieve text formatting in HTML?

 Using Text formatting we can change the over all view of the sentence.like that:
Example:
<b>          This is bold text
<i>           This is a italic text
                I have given you some basic formatted tags.
<b>         Used to create bold text
<big>       Used to create big text
<em>      Used to emphasized text
<i>          Used to made italic text
<small>   Used to create small text
<strong>  Used to made strong text
<sub>      Used to subscripted text
<sup>      Used to superscripted text
<ins>       Used to inserted text
<del>       Used to deleted text
<s>         Deprecated. Use <del> instead
<strike>   Deprecated. Use <del> instead
<u>         Deprecated. Use styles instead

What are the output tags?

 HTML provide some output tags that are given below:
     
<code>         Used for computer code text
<kbd>          Used for keyboard text
<samp>       Used for sample computer code
<tt>             Used for teletype text
<var>           Describe a variable
<pre>          Describe preformed text
<listing>      Deprecated. Use <pre> instead
<plaintext>  Deprecated. Use <pre> instead
<xmp>        Deprecated. Use <pre> instead

What is the nested element in HTML?

 In HTML we create nested element mostly.

Example:
<html>
<body>
<title>This is my first HTML page.</title>
<p>HTML is used to create static pages.</p>
</body>
</html>

In the above example we have given you four HTML element.First HTML element start with <html> and end with</html>. Second HTML element start with <body> and end with</body>.Third HTML element start with <title> and end with </title> Fourth HTML element start with <p> and end with </p>.

HTML is case sensitive or not?

 No, HTML is not a case sensitive language.In this we can use an uppercase HTML tags or lowercase HTML tag both.Means in the case of HTML both tags <title> and <TITLE> are same.But we have try to use lowercase tags.Because new versions of HTML support only lowercase tags.Like: HTML 4
 

What is W3C ?

WeC is stands for a World Wide Web Consortium. The international body that governs Internet standards. 

How you understand about Forms output?

Using Forms in HTML we can select client input in different manner. In form is use to contain form elements.Using Form elements we can allow the user to enter information (like: text fields, textarea fields, drop-down menus, radio buttons, checkboxes, etc.) in a form.

We start form by using

<form>
<input type=\"text\" name=\"username\" value=\"2\" />
<input type=\"hidden\" name=\"id\" value=\"3\" /> tag.
<input type=\"hidden\" name=\"fname\" value=\"1\" />
<input type=\"button\" name=\"OK\" value=\"OK\" />
</form>

How you use Text Field,Radio Button and Checkbox in Form?

 We use above in the <input> tag of the form.

Text Field: We used Text fields when we want that user entered like letters, numbers etc. in a form.

Example:
<form>
<input type=\"hidden\" name=\"fname\" value=\"1\" />
User name: <input type=\"text\" name=\"username\">
Password: <input type=\"password\" name=\"password\">
</form>

Radio Buttons:
We use Radio Buttons when we want that user select one of a limited number of choices.

Example:
<form>
<input type=\"radio\" name=\"Gender\" value=\"male\"> Male
<input type=\"radio\" name=\"Gender\" value=\"female\"> Female
</form>

Checkboxes:
We use Checkboxes When we want that user can select one or more options of a limited number of choices.

Example:


<form>
I have a computer:<input type=\"checkbox\" name=\"electronicdevice\" value=\"Computer\">
I have a TV: <input type=\"checkbox\" name=\"electronicdevice\" value=\"TV\">
I have a AC: <input type=\"checkbox\" name=\"electronicdevice\" value=\"AC\">
</form>

How you use Form\'s Action Attribute and Submit Button in HTML?

 Using Submit Button we can sends the form to the server and Action Attribute is specified that which file we send.

<form name=\"input\" action=\"submit_form.php\" method=\"get\">
<input type=\"hidden\" name=\"id\" value=\"1\" />
 Formname: <input type=\"text\" name=\"username\">
<input type=\"submit\" value=\"Submit\">
</form>

When we click the sumbit button web page than the submit_form is send to the server.

How you use scipts on HTML?

We use scripts on HTML page for making HTML page Dynamic. To use scripts on HTML page we use <script> tag.

Example:

<html>
<head>
</head>
<body>
<script type=\"text/javascript\">
document.write(\"R4R Welcomes You!\")
</script>
</body>
</html>
output:
R4R Welcomes You!

How to blink text in IE6?

 Content that we write b/w the <blink> tag will blink on HTML page.

Syntax:
<blink>text want to blink</blink>

How to differ width=\'200\' and width=\'200%?

There are many differences b/w width=\"200\" and width=\"200%\". 

I have given you main difference.If you want create a table set width=\"200\". Means that width of table is 200 which is fixed.But

When we write width=\"200%\" then 200% table will display in its full view and can changed according the resolution and browser.

What is Semantic in HTML?

 I have given two reasons of use Semantic HTML.
1.Always avoid the use of markup that present you HTML document.Like: element, attribute etc.
2.Try to use available markup to differentiate the meanings of phrases and structure in the document.

Example:
<cite class=\"booktitle\">The Grapes of Wrath</cite>

Above,the <cite> element is used because it most closely matches the meaning of this phrase in the text.

How you display an picture in background of HTML?

 We can display an picture in background of HTML page using that code.

Syntax:
<body style=\"background-image:url(image path)\">

How you define body in HTML?

 Body in HTML specifies the all contents of the document.Means that it contain the text,images, colors,graphics etc. 

How you define SPAN in HTML?

We use SPAN by using <SPAN> tag in HTML.

Syntax:<SPAN>............</SPAN>
Used to highlight any color text, for adding colored text, for adding background image to text. SPAN not a cause of line break. It delimits text and using them we can use style to the \'elemental\' region without any break in Text.

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

How you define HEAD in HTML?

Head is placed before the body in the HTML.It is use to display only the general information or unordered collection to information about the HTML document.

How you define index document?

 Many times we have require index.htm / document because it is a standard for the host-server to look for the document and deploy it.Default document to be displayed in the web.

How Cell Padding is differ from Cell Spacing?

 I have given you how cell padding is differ from cell spacing given below:

Cell Padding: Cell Padding in HTML: is used to define the how much space need b/n cell content and cell edges.

Syntax:

< table width=\"200\" border=\"1\" cellpadding=\"3\">


means that it takes 3 pixels of padding inside the each cell.

Cell Spacing: It is also used to format the table.but it differ than cell padding because in cell padding we can set an extra space to separate the cell content with cell edges.Where as we use cell spacing to set the space b/w the cells.

Syntax:
< table width=\"200\" border=\"1\" cellspacing=\"10\">


We can use cell padding and cell spacing together like that,

< table width=\"200\" border=\"1\" cellpadding=\"3\" cellspacing =\"10\">

What do you understand about DOCTYPE in HTML?

 DOCTYPE is stands for Document Type Declaration.In an HTML every HTML document is started with DOCTYPE declaration.It may be differ for different versions of HTML.DOCTYPE is used only bySGML tools like as HTML validator. 
Example of Document Type Declaration in HTML 4 are,
<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">

Attibutes names and their values are case-sensitive or not?

Yes,Attributes and their values are case-sensitive. Both should be write on lowercase letters.In new versions of HTML W3C(World Wide Web Consortium) strongly said to use lowercase letters.Like: HTML 4,XHTML etc are use lowercase attributes with values should be write on lowercase letters.

HTML Subjective Questions And Answers