Vous êtes sur la page 1sur 5

HTML QUESTION AND ANSWERS..!

Question: What is an HTML Tag or an HTML Element?


If you are going to start learning HTML, one of the first things you should understand are the specific terms that are used. Two of the terms you will see most often are tag and element and they almost mean the same thing. Answer: What is an HTML Tag or an HTML Element? What is an HTML Tag or an HTML Element? What is an HTML Tag or an HTML Element? HTML Tags HTML is a markup language, which means that it is written with codes that can be read by a person, without needing to be compiled. In essence, the text on a web page is marked up with these codes to tell the browser how to display the text. And these markup tags are the HTML tags themselves. When you write HTML, you are writing HTML tags. These are made up of:

A less-than sign < A word or character Optional space followed by: Any number of optional HTML attributes in the form of a name="value" pair And finally a greater-than sign >

What is HTML?
A guide to learning html for beginners. HTML are initials that stand for Hyper Text Markup Language Hyper is the opposite of linear. It used to be that computer programs had to move in a linear fashion. This before this, this before this, and so on. HTML does not hold to that pattern and allows the person viewing the World Wide Web page to go anywhere, any time they want. Text is what you will use. English letters, just like you use everyday.. Markup is what you will do. You will write in plain English and then mark up what you wrote. Language. Some may argue that technically html is a code, but you write html in plain, everyday English language.

What is method..?
Methods define functions performed by an object. Making a reference to an object method is similar to referencing its property. Thus, document.write(); calls the write() method of the document object. Herein lies an important difference in how methods and properties are refered. Methods are always followed by a pair of parenthesis. Some methods take a value part inside the parenthesis. You would know this by now since you have encountered the write() method in the previous sessions. To refresh your memory here is the code again:
document.write("I Love JavaScript");

The text I Love JavaScript is passed as a value to the write() method of the document object. The main function of this method is to take the value and display it in the browser window. Different objects have different methods associated with them. The submit() method of a form object causes the form to be submitted. The log() method of the Math object computes the logarithm of the number supplied.

document.myform.submit(); causes myform to be submitted.

Math.log(2); computes the logarithm of 2. The number is passed to the method inside the parenthesis and is called the argument. Similarly, in the example before, I Love JavaScript was the argument passed to the write() method.

1.

What do you think following methods do? a. Math.tan(3); b. Math.sqrt(4); c. d. e. document.write("www.webdevelopersnotes.com"); window.close(); window.scroll();

difference between id and name..?


The name is used when sending data in a form submission. Different controls respond differently. For example, you may have several radio buttons with different ids, but the same name. When submitted, there is just the one value in the response - the radio button you selected. Of course, there's more to it than that, but it will definitely get you thinking in the right direction. Use id attributes whenever you need to address a particular HTML element with CSS, JavaScript or a fragment identifier. It's possible to look up elements by name, too, but it's more efficient to look them up by ID.

Whats the difference? The short answer is, use both and dont worry about it. But if you want to understand this goofiness, heres the skinny: name= is for use as a target like this: <a name="XXX"></a> for links like this: <a href="#XXX". name= is also used to label the fields in the message send to a server with an HTTP (HyperText Transfer Protocol) GET or POST when you hit submit in a form. id= labels the fields for use by JavaScript and Java DOM (Document Object Model). The names in name= must be unique within a form. The names in id= must be unique within the entire document. Sometimes the the name= and id= names will differ, because the server is expecting the same name from various forms in the same document or various radio buttons in the same form as in the example above. The id= must be unique; the name= must not be. JavaScript needed unique names, but there were too many documents already out here without unique name= names, so the W3 people invented the id tag that was required to be unique. Unfortunately older browsers did not understand it. So you need both naming schemes in your forms.

What is attribute?
Attributes provide additional information about HTML elements.

HTML Attributes

HTML elements can have attributes Attributes provide additional information about an element Attributes are always specified in the start tag Attributes come in name/value pairs like: name="value"

Example
<a href="http://www.w3schools.com">This is a link</a>

What is div tag?


The <div> tag is supported in all major browsers.

Definition and Usage


The <div> tag defines a division or a section in an HTML document. The <div> tag is used to group block-elements to format them with CSS.

Tips and Notes


Tip: The <div> element is very often used together with CSS, to layout a web page. Note: By default, browsers always place a line break before and after the <div> element. However, this can be changed with CSS.

Differences Between HTML 4.01 and HTML5


The align attribute not supported in HTML5. The align attribute is deprecated in HTML 4.01.

Attributes
Attribute align Value left right center justify Description Not supported in HTML5. Deprecated in HTML 4.01.Specifies the alignment of the content inside a <div> element

What are the html global attribute?

HTML Global Attributes


New : New global attributes in HTML5.

Attribute accesskey class

Description Specifies a shortcut key to activate/focus an element Specifies one or more classnames for an element (refers to a class in a style sheet) Specifies whether the content of an element is editable or not Specifies a context menu for an element. The context menu appears when a user right-clicks on the element Specifies the text direction for the content in an element Specifies whether an element is draggable or not Specifies whether the dragged data is copied, moved, or linked, when dropped Specifies that an element is not yet, or is no longer, relevant Specifies a unique id for an element Specifies the language of the element's content Specifies whether the element is to have its spelling and grammar checked or not Specifies an inline CSS style for an element Specifies the tabbing order of an element Specifies extra information about an element

contenteditableNew contextmenuNew

dir draggableNew dropzoneNew

hiddenNew id lang spellcheckNew

style tabindex title