HTML

Explain about meta tag and base tag in HTML give an example for it.
amunitAsked:
Who is Participating?
 
freshmeatConnect With a Mentor Commented:
hi, here is something copied from MSDN, if u r patient enough, pls read it out, it is very complete, and , ha, don't forget to give me points
:D

about meta tag:
------------------------------
META Element | META Object

--------------------------------------------------------------------------------

Conveys hidden information about the document to the server and the client.


<META
    CONTENT=description
    HTTP-EQUIV=response
    NAME=text
    TITLE=text
>


Remarks

The META element also embeds document information that some search engines use to index and categorize documents on the World Wide Web.

This element can be used only within the HEAD element.

The META element does not require a closing tag.

This element is available in HTML as of Microsoft® Internet Explorer 3.0, and in script as of Internet Explorer 4.0.

Members

AllAttributesPropertiesMethodsEventsCollectionsBehaviors   Description
CONTENT  Sets or retrieves meta-information to be associated with HTTP-EQUIV or NAME.
HTTP-EQUIV  Sets or retrieves information used to bind the META tag's content to an HTTP response header.
NAME  Sets or retrieves the value specified in the CONTENT attribute of the META object.

* denotes an extension to the W3C DOM.

--------------------------------------------------------------------------------



about base tag:
------------------------------
BASE Element | BASE Object

--------------------------------------------------------------------------------

Specifies an explicit URL used to resolve links and references to external sources such as images and style sheets.


<BASE
    HREF=url
    TARGET=window_name | _blank | _parent | _search | _self | _top
>


Remarks


When used, the BASE element must appear within the HEAD of the document, before any elements that refer to an external source.

The BASE element does not require a closing tag.

This element is available in HTML as of Microsoft® Internet Explorer 3.0, and in script as of Internet Explorer 4.0.

Members

AllAttributesPropertiesMethodsEventsCollectionsBehaviors   Description
HREF  Sets or retrieves the baseline URL on which relative links will be based.
ID  Retrieves the string identifying the <BASE>.
TARGET  Sets or retrieves the window or frame at which to target the contents.

* denotes an extension to the W3C DOM.
Example

This example sets the base URL of the document to a reference folder. Internet Explorer uses the BASE element to resolve the link to http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/href_2.asp.

<HEAD>
<BASE HREF="http://msdn.microsoft.com/workshop/author/dhtml/reference">
</HEAD>

<BODY>
Click <A HREF="properties/href_2.asp">here</A> to learn about the
href property.
</BODY>

This example retrieves the base URL from the document if a valid BASE element is specified in the document. Otherwise, the function returns null.

<SCRIPT>
function GetBase()
{
    var oBaseColl = document.all.tags('BASE');
    return ( (oBaseColl && oBaseColl.length) ? oBaseColl[0].href :
        null );
}
</SCRIPT>

0
 
xabiCommented:
0
 
nettromCommented:
stars.com seems to be slightly close-minded.  BASE can be used to other things besides HREF (TARGET is my first thought).  <base target="_top"> shouldn't validate (according to http://www.w3.org/TR/html4/struct/links.html#h-12.4), but it's commonly used to set the base target for frames so one doesn't have to run around and remember it all the time.  the HTML 4.01 spec suggests <base href="http://someserver.com/" target="_top"> when one wants to define the target (see http://www.w3.org/TR/html401/present/frames.html#h-16.3 and the following paragraphs & sections).

the HTML4.01 spec about the META element:
http://www.w3.org/TR/html4/struct/global.html#h-7.4.4
0
 
nettromCommented:
freshmeat: http://www.w3.org/TR/html4/ is a nice thing to have in your bookmarks (or favorites, if you prefer that).

I wouldn't trust Microsoft at all when it comes to HTML.
0
 
freshmeatCommented:
ha, nettrom, i agree with u
i don't like M$, either
i am a linuxer

0
All Courses

From novice to tech pro — start learning today.