What Is HTML
What Is HTML
HTML ( H yper T ext M arkup L anguage) is the language used to write Web pages. You are
looking at a Web page right now.
Answer1:
HTML, or HyperText Markup Language, is a Universal language which allows an individual
using special code to create web pages to be viewed on the Internet.
Answer2:
HTML ( H yper T ext M arkup L anguage) is the language used to write Web pages. You are
looking at a Web page right now.
You can view HTML pages in two ways:
* One view is their appearance on a Web browser, just like this page -- colors, different text
sizes, graphics.
* The other view is called "HTML Code" -- this is the code that tells the browser what to do.
What is a tag?
In HTML, a tag tells the browser what to do. When you write an HTML page, you enter tags for
many reasons -- to change the appearance of text, to show a graphic, or to make a link to another
page.
An HTML comment begins with "<!--", ends with "-->", and does not contain "--" or ">"
anywhere in the comment.
The following are examples of HTML comments:
Do not put comments inside tags (i.e., between "<" and ">") in HTML markup.
<table>
<tr>
<td>this is the first cell of the outer table</td>
<td>this is the second cell of the outer table,
The main caveat about nested tables is that older versions of Netscape Navigator have problems
with them if you don't explicitly close your TR, TD, and TH elements. To avoid problems,
include every </tr>, </td>, and </th> tag, even though the HTML specifications don't require
them. Also, older versions of Netscape Navigator have problems with tables that are nested
extremely deeply (e.g., tables nested ten deep). To avoid problems, avoid nesting tables more
than a few deep. You may be able to use the ROWSPAN and COLSPAN attributes to minimize
table nesting. Finally, be especially sure to validate your markup whenever you use nested tables.
<FORM ACTION="[URL]">
<TABLE BORDER="0">
<TR>
<TH>Account:</TH>
<TD><INPUT TYPE="text" NAME="account"></TD>
</TR>
<TR>
<TH>Password:</TH>
<TD><INPUT TYPE="password" NAME="password"></TD>
</TR>
<TR>
<TD> </TD>
<TD><INPUT TYPE="submit" NAME="Log On"></TD>
</TR>
</TABLE>
</FORM>
<div class="center">
<table>...</table>
</div>
div.center {
text-align: center;
}
div.center table {
margin-left: auto;
margin-right: auto;
text-align: left;
}
<script type="text/javascript">
document.myform.myinput.focus();
</script>
A similar approach uses <body onload=...> to set the focus, but some browsers seem to process
the ONLOAD event before the entire document (i.e., the part with the form) has been loaded.
You can also use a CSS style sheet to affect all the forms on a page:
form { margin-bottom: 0 ; }
How can I use tables to structure forms?
Small forms are sometimes placed within a TD element within a table. This can be a useful for
positioning a form relative to other content, but it doesn't help position the form-related elements
relative to each other.
To position form-related elements relative to each other, the entire table must be within the form.
You cannot start a form in one TH or TD element and end in another. You cannot place the form
within the table without placing it inside a TH or TD element. You can put the table inside the
form, and then use the table to position the INPUT, TEXTAREA, SELECT, and other form-
related elements, as shown in the following example.
<form action="[URL]">
<table border="0">
<tr>
< th scope="row">
<label for="account">Account:</label>
</th>
<td>
<input type="text" name="account" id="account">
</td>
</tr>
<tr>
< th scope="row">
<label for="password">Password:
</th>
<td>
<input type="password" name="password" id="password">
</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Log On"></td>
</tr>
</table>
</form>
1. The browser strips everything after the last slash in the base document's URL and appends the
relative URL to the result.
2. Each "." segment is deleted (e.g., ./all.html is the same as all.html, and ./ refers to the current
"directory" level in the URL hierarchy).
3. Each ".." segment moves up one level in the URL hierarchy; the ".." segment is removed,
along with the segment that precedes it (e.g., foo/../all.html is the same as all.html, and ../ refers
to the parent "directory" level in the URL hierarchy).
Some examples may help make this clear. If the base document is
<URL:http://www.yoursite.com/faq/html/basics.html>, then
Please note that the browser resolves relative URLs, not the server. The server sees only the
resulting absolute URL. Also, relative URLs navigate the URL hierarchy. The relationship (if
any) between the URL hierarchy and the server's filesystem hierarchy is irrelevant.
Next, identify the links that you want to have different colors. You can use the CLASS attribute
in your HTML, like this:
Alternatively, you can identify an element that contains the links that you want to have different
colors, like this:
<div class="example2">...
<a href="[URL]">[link text]</a>...
<a href="[URL]">[link text]</a>...
<a href="[URL]">[link text]</a>...
</div>
Then, in your style sheet, use a selector for links in this containing element, like this:
* Escape any quotes inside the value with " so you don't terminate the value prematurely:
ALT="the "King of Comedy" takes a bow".
* Use single quotes to enclose the attribute value: ALT='the "King of Comedy" takes a bow'.
Both these methods are correct according to the specification and are supported by current
browsers, but both were poorly supported in some earlier browsers. The only truly safe advice is
to rewrite the text so that the attribute value need not contain quotes, or to change the interior
double quotes to single quotes, like this: ALT="the 'King of Comedy' takes a bow".
2. Numbered Lists: <ol> begins a numbered, indented list. Each item in the list is then prefaced
with the <li> tag. You need to close the list with the </ol> tag. Note: You can expand the <ol> to
specify the TYPE of numbering:
<td ...>
<img src=... alt=...>
<img src=... alt=...>
</td>
with this:
Not all browsers support form-based file upload, so try to give alternatives where possible.
The Perl CGI.pm module supports file upload. The most recent versions of the cgi-lib.pl library
also support file upload. Also, if you need to do file upload in conjunction with form-to-email,
the Perl package MIME::Lite handles email attachments.
How can I require that fields be filled in, or
filled in correctly?
Have the server-side (e.g., CGI) program that processes the form submission send an error
message if the field is not filled in properly. Ideally, this error message should include a copy of
the original form with the original (incomplete or incorrect) data filled in as the default values for
the form fields. The Perl CGI.pm module provides helpful mechanisms for returning partially
completed forms to the user.
In addition, you could use JavaScript in the form's ONSUBMIT attribute to check the form data.
If JavaScript support is enabled, then the ONSUBMIT event handler can inform the user of the
problem and return false to prevent the form from being submitted.
Note that the server-side program should not rely upon the checking done by the client-side
script.
The modern way to label the destination of the link is with an ID attribute. For example:
<h2 id="section2">Section 2: Beyond Introductions</h2>
Second, link to the labeled destination. The URL is the URL of the document, with "#" and the
value of the NAME or ID attribute appended. Continuing the above examples, elsewhere in the
same document you could use:
<a href="#section2">go to Section 2</a>
If you want to line up buttons next to each other, you will have to put them in a one-row table,
with each button in a separate cell.
Note that search engines might not find the target document unless there is a normal link
somewhere else on the page.
A go-to-other-page button can also be coded in JavaScript, but the above is standard HTML and
works for more readers.