News:

This week IPhone 15 Pro winner is karn
You can be too a winner! Become the top poster of the week and win valuable prizes.  More details are You are not allowed to view links. Register or Login 

Main Menu

HTML commands - Format of a tag

Started by ben2ong2, October 03, 2006, 05:43:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ben2ong2

The HTML files are plain ASCII text files that are displayed by the browser in whatever form you have specified. TAGS control the layout and formatting of the elements in HTML. These tags (and there are quite a few of them) are the building blocks of HTML.

The basic syntax of a tag:


<TAG-NAME {ATTRIBUTE1{="VALUE1" ...}}>{Some text that is affected}</TAG-NAME>


The above notation might seem confusing to you at first; let's break it down:

Each tag consists of the name of the tag surrounded by the less-than '<' and greater-than '>' signs.
Tag names cannot contain spaces. Thus, <HT ML> is wrong.
Most (not all) tags require an end tag that differs with the opening tag by a slash '/'. Thus if the opening tag is <TITLE> the end tag will be </TITLE>. Note: XML requires all tags to have an ending tag, so if you are working on XML, be sure to place closing tags for everything.
Attributes control the different properties of the tag. Each tag has some default values for its attributes. To modify these, you have to set the attributes to the new values. For example, if you want to draw a horizontal rule across the page you can use the <HR> tag. This puts a shaded rule across the page like this:


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

The <HR> tag without any attributes, draws a full length (100%) rule across the page. To decrease its length to half its value, you should specify "50%" value to the WIDTH attribute. The attibute-value pair is written inside the starting tag. Thus, with <HR WIDTH="50%">, we get a shorter horizontal rule:


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

A tag can have many attributes and each attribute may have many values (some attributes have no value). More than one attribute can be placed in a tag.
Tags usually surround some text. This text is displayed based on the instructions contained in the tag and its attributes.
A simple example is the Bold (<B> and </B>) tag. When these tags are placed surrounding some text, it becomes bold as:
This is bold text
(<B>This is bold text</B>)
Browsers ignore unknown tags and attributes. For example, <BOOK> does not have any meaning to the browser and is ignored. (Note: There are some non-standard tags, which are interpreted only by a particular browser and ignored by others. Such tags are browser specific.)
You are not allowed to view links. Register or Login
You are not allowed to view links. Register or Login