HTML

"21" questions available for HTML.


Q. What are the differences between Get and post methods.

Difference between GET and POST method :

  1. GET Method have some limit like only 2Kb data able to send for request, but in POST method unlimited data can we send.
  2. On using GET method, the data transfered to the requested page via url but Not in POST method so POST method is good for sending sensitive data like user-name or password of a user.
  3. Get request can be cached but POST request can never be cached.
  4. Get request can be Bookmarked but POST request can not be bookmarked.

Q. What is the relationship between SGML,HTML , XML and XHTML?

SGML (Standard generalized markup language) is a standard which tells how to specify document markup. It’s only a Meta language which describes how a document markup should be.
HTML is a markup language which is described using SGML.
So, by SGML they created DTD (Document Type Definition) which the HTML refers and needs to adhere to the same. So you will always find “DOCTYPE” attribute at the top of HTML page which defines which DTD is used for parsing purpose.


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Now parsing SGML was a pain so they created XML to make things better. XML uses SGML. For example in SGML you have to start and end tags but in XML you can have closing tags which close automatically (“”).
XHTML was created from XML which was used in HTML 4.0. So for example in SGML derived HTML “ ” is not valid but in XHTML it’s valid. You can refer XML DTD as shown in the below code snippet.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
In short SGML is the parent of every one. Older HTML utilizes SGML and HTML 4.0 uses XHTML which derived from XML.

Q. What is an iframe in HTML?

iframe is used to display a web page within a web page.


<html>
<head>
 <title>My Home Page</title>
</html>
<body>
 <h1> Use of Iframe. </h1>
 <iframe src="www.google.com" ></iframe>
</body>

Q. What is DTD .? What is its purpose.?

DTD is Document Type Definition. The purpose of a DTD is to define the legal building blocks of an XML document. A DTD defines the document structure with a list of legal elements and attributes. Example:


<?xml version="1.0"?>
<!DOCTYPE note [
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>

Q. What is the difference between class and id ?

The id selector uses the id attribute of an HTML tag to find the specific element. An id should be unique within a page, so you should use the id selector when you want to find a single, unique element.To find an element with a specific id, write a hash character, followed by the id of the element.


<div id="head"> My Heading inside div </div>
The class selector finds elements with the specific class. The class selector uses the HTML class attribute.To find elements with a specific class, write a period character ( . ), followed by the name of the class.

<div class="head"> My Heading inside div </div>

Q. How you can add a background music at your web page ?

You can add the background music in your web page by following way:

  1. If You want to play it once then use the below code.
    
    <bgsound src="bgmusic.mid" loop="1">
    
  2. If You want to play it continuously, then change the number in loop to a higher value in above example, say loop=100 or loop="infinite".
  3. If you needs this to work with Netscape and Internet Explorer, or other older browser you can use the embed tag to implement music to your page using code similar to the example below.
    
    <embed src="music.mid" Autostart=TRUE height=60 width=145  loop=true>
    


Start a discussion...or just leave a comment.