Basic Html Commands

  • Uploaded by: Vedamurthy J
  • 0
  • 0
  • October 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Basic Html Commands as PDF for free.

More details

  • Words: 6,081
  • Pages: 36
Basic HTML commands This section covers some basic HTML commands and explains the steps involved in preparing a document for viewing via the World Wide Web.

Basic steps: using tags HTML uses tags to communicate to the client (browser) how to display text and images. Tags are contained in < > symbols. In most cases you start with the beginning tag, put in the word or words that will be affected by this tag, and at the end of the string of word(s), you place a closing tag.

For example, to create a title for a document you would do the following: My First HTML Document

The closing tag normally contains a "/" before the directive to indicate the termination of the action.

HTML tags are not case-sensitive, although URLs generally are. In most cases (with the exception of preformatted text) HTML collapses many spaces to one space and does not read blank lines. However, when you write your text you should leave several blank lines between paragraphs to make editing your HTML source document easier. The HTML tag Although not currently required by all clients, the tag signals the point where text should start being interpreted as HTML code. It's probably a good idea to include it in all your documents now, so you don't have to go back to your files and add it later.

The tag is usually placed on the first line of your document. At the end of your document you should close with the tag. The head tag Just like the header of a memo, the head of an HTML document contains special information, like its title. The head of a document is demarcated by and respectively.

For the purposes of this class, only the title tag, below, should be included in the document head. A typical head section might look like My First HTML Document



Titles A title tag allows you to specify a Document Title in your browser window. When people make hotlists, this title is what they see in their list after they add your document. The format is: My First HTML Document

Remember, the title usually doesn't appear in the document itself, but in a title box or bar at the top of the window. The body tag Like you might expect, the body tags and define the beginning and end of the bulk of your document. All your text, images, and links will be in the body of the document.

The body should start after the head. A typical page might begin like My First HTML Document

Headers There are up to six levels of headers that can be used in your document, h1 through h6. Header 1 is the largest header and they get progressively smaller through header 6. Below are each of the six headers and how they usually appear in relation to one another.

This is a header 1 tag



This is a header 1 tag

This is a header 2 tag



This is a header 2 tag

This is a header 3 tag



This is a header 3 tag

This is a header 4 tag



This is a header 4 tag
This is a header 5 tag


This is a header 5 tag
This is a header 6 tag


This is a header 6 tag Headers, as you notice, not only vary in size, they are also bold and have a blank line inserted before and after them. It's important to use headers only for headings, not just to make text bold (we cover the bold tag later). Paragraphs In HTML, a paragraph tag

should be put at the end of every paragraph of "normal" text (normal being defined as not already having a tag associated with it).

causes a line break and adds a trailing blank line
causes a line break with no trailing blank line As a convenience to yourself and others who might have to edit your HTML documents, it's a very good idea to put two or three blank lines between paragraphs to facilitate editing. Preformatted text The preformatted text tag allows you to include text in your document that normally remains in a fixed-width font and retains the spaces, lines, and tabs of your source document. In other words, it leaves your text as it appears initially or just as you typed it in. Most clients collapse multiple spaces into one space, even tabs are collapsed to one space. The only way to circumvent this is to use the preformatted tag. Visually, preformatted text looks like a courier font. <pre>this is an example of a preformatted text tag

And this is how it displays: this is

an example of a preformatted text tag

Boldface and Italics You can add emphasis to text by using the boldface and italic tags or the emphasis and strong tags.

There is an underline tag as well, but most people don't use it since text that is linked is often underlined. The potential for confusion and the archaic nature of underlining in general make it a poor marker for emphasis. When using these tags, you usually cannot (and probably should not) have text that is both boldface and italics; the last tag encountered is usually the tag that is displayed. For example, if you had a boldface tag followed immediately by an italic tag, the tagged word would appear in italics. Physical tags This is a boldface tag. This is how boldfacing appears. This is an italic tag. This is how italics appear. Logical tags This is a <strong>strongly emphasized tag. This is a strongly emphasized tag. This is an <em>emphasized tag. This is an emphasized tag. There is a subtle distinction between the above "physical" tags which merely change the displayed font, and "logical" styles which are used (or eventually will be) to make types of emphasis client specific (for instance, using the <em> tag would make text red). While either style is fine, be aware that differences in these two kinds of tags may be more apparent with advances in HTML. Lists There is an easy way in HTML to have numbered, unnumbered, and definition lists. In addition, you can nest lists within lists.

When using lists, you have no control over the amount of space between the bullet or list number, HTML automatically does this for you. Neither (as yet) do you have control over what type of bullet will be used as each browser is different.

Unnumbered lists Unnumbered lists are started with the

    tag, followed by the actual list items, which are marked with the
  • tag. The list is ended with the ending tag
.

For example, here is an unnumbered list with three items:
  • list item 1
  • list item 2
  • list item 3


Here is how that list would display: • • •

list item 1 list item 2 list item 3

Numbered lists Here is the same list using a numbered list format:
  1. list item 1
  2. list item 2
  3. list item 3


Here is how that list would display: 1. list item 1 2. list item 2 3. list item 3 Definition lists Definition lists allow you to indent without necessarily having to use bullets.
This is
This is
And yet
Another
Another


a term a definition another definition term definition

And here is how this would be displayed This is a term This is a definition. And yet another definition. Another term

Another definition Nested lists Finally, here is a nested list within an unnumbered list (we could just have easily had a nested list within a numbered list).
  • list item 1
    • nested item
    • nested item
  • list item 2
    • nested item
    • nested item
  • list item 3
    • nested item
    • nested item


1 2

1 2

1 2

Here is how that list would display: •





list item 1 o nested o nested list item 2 o nested o nested list item 3 o nested o nested

item 1 item 2 item 1 item 2 item 1 item 2

Blockquote The blockquote tag indents the text (both on the left and right) inside the tags. The blockquote tag looks like this:
...


and displays like this:

Blockquoted text is often used for indenting big blocks of text such as quotations. The text will be indented until the ending tag is encountered. Again, note that the text here is indented on both the left and the right margins. Center You can center text, images, and headings with the center tag:

This is a centered sentence


This is a centered sentence.

The center tag automatically inserts a line break after the closing center tag. Horizontal Rule To separate sections in a document, you can insert a horizontal rule tag
. A horizontal rule is displayed as follows: Addresses The
tag normally appears at the end of a document and is used most frequently to mark information on contacting the author or institution that has supplied this information. Anything contained within the address tag appears in italics. The address tag is another example of a logical tag, and although it currently does nothing but make text appear in italics, this could change as HTML code advances.

Here is an example of how an address might appear:
Introduction to HTML / Pat Androget / [email protected]


And it would appear as:

Introduction to HTML / Pat Androget / [email protected] Comments It is possible to include comments in a source HTML document that do not appear when seen through a browser. This is most useful for giving warnings and special instructions to future editors of your document.

Comments take the form:

The comment can even break lines



Strike-through Should you want it, there is a strike-through tag which displays text with a strike. <strike>This is struck through text

displays as

This is struck through text

Special Characters Finally, if you often use the characters which make up HTML tags (such as < >, and &), or you use special characters not in the ascii standard, you will have to use special tags. Here are the codes: á à ã é ð í ï ó ø " ú ü

.... .... .... .... .... .... .... .... .... .... .... ....

á à ã é ð í ï ó ø " ú ü

â & ä ê ë î < ô õ ß û ý

.... .... .... .... .... .... .... .... .... .... .... ....

â & ä ê ë î < ô õ ß û ý

æ å ç è > ì ñ ò ö þ ù ÿ

Tag Name Link.



Bold the text within the tag.




æ å ç è > ì ñ ò ö þ ù ÿ

Usage



.... .... .... .... .... .... .... .... .... .... .... ....

The information within this tag is the body of the HTML document. Line break. Center the text within the tag. Specify the font type, size, and color for the text within the tag. Specifies the properties within each frame.

Signifies that this HTML page is composed of frame(s).

...

The text within these tags are treated as headers.
  • <meta>

    The text within this tag specifies the header information for the HTML document. Italicize the text within the tag. Specifies the image to be shown on the HTML document. Itemized list. Specifies information about this HTML page. This information is not displayed on the browser  but may be used by search engines.



      Ordered list, usually followed by one or more 
    1.  tags.



      New paragraph.



      Signifies the presence of an HTML table.



      Specifies row properties in a table.

      <br /> <br /> The text within this tag specifies the title of the HTML document.<br /> <br /> <u><br /> <br /> Underline the text within the tag.<br /> <br /> <ul><br /> <br /> Unordered list, usually followed by one or more <li> tags.<br /> <br /> HTML Commands We offer this table as a quick reference to supplement the HTML tutorial. It shows the commands, a brief statement of their use, which attributes can modify them, and which commands they can inhabit or include, but it doesn't go over the basics of HTML syntax. If you're new to HTML, visit Spin Doctor's Web Design 101 first.<br /> <br /> Body: Global Head<br /> <br /> Commands<br /> <br /> Purpose<br /> <br /> Character Formatting Breaks, Headings, and Titles Images and Forms Lists and Tables Hypertext Anchors<br /> <br /> Attributes and Extensions<br /> <br /> Can Subsume:<br /> <br /> Can be Nested inside:<br /> <br /> Global <<<Top Next>><br /> <br /> <!--...--><br /> <br /> allows you to insert a line of some browsers may execute the tags browser-invisible comments in inside comment lines, so it's best to<br /> <br /> your document<br /> <br /> <html>...</html><br /> <br /> marks the opening and closing <head>...</head> surrounds all other of an HTML document <body>...</body> HTML commands<br /> <br /> <head>...</head><br /> <br /> creates the head of an HTML document<br /> <br /> <body>...</body><br /> <br /> background= designates a file to be displayed as background bgcolor="#(hexade cimal color code)" sets the background color text="#(hexadecim al color code)" sets creates the color of plain the body text of an link="#(hexadecim HTML al color code)" sets document the color of unfollowed text links alink="#(hexadeci mal color code)" sets the color of active text links vlink="#(hexadeci mal color code)" sets the color of visited text links<br /> <br /> <isindex> Head<br /> <br /> avoid nesting commands within comments<br /> <br /> activates the browser's searching function<br /> <br /> <title>... <meta>

      all lists, anchors, tables, forms, images, text, breaks, characters, and headings

      HTML 3.0: prompt="..." allows you to specify the search prompt. (default prompt is "This is a searchable index. Enter search keywords:")

      immediately after and before ...

      inside ... and after ...

      ...
      ...
      or
    2. ... ...

      <>



      this command , primarily used by HTMLgeneratin g tools, indicates a relationsh ip to other document s (and unlike anchors, cannot indicate relationsh ips to parts of document s)

      <meta>

      allows you to specify metacont ent (selfreferentia l content, or informati on about the document itself-meant to be read by machines )



      href="url" of document linked to this one name=anchor (if the link is an anchor) rel="(linked to document in relation to this document)" rev="(reverse rel b/w this doc and other doc)" urn=uniform resource number title="title of linked-to doc" methods="ftp, gopher, etc." (method of retrieving other document)

      inside ... http-equiv="name" content="value" names a new HTTP header field whose data will be specified as CONTENT HTTP-Equiv="Expires content="never" name="key" of key/value pair. content="value" of key/value pair.

      indicates the full URL of href="URL" the

      Body <>

      Formatting <>

      ...

      centers enclosed text

      ... Netscape extension the value for the size attribute can be a number from 1 to 7 (default is 3), or (in quotation marks) a number relative to the current size, e.g. "+2".


      ... or
      ... ... ress> <em>... <strong>...... g> ...
      ... <samp>...
      or
    3. ... ...
    4. or ............

      ... ...

      ...... ess> <strong>...... g> ... ... ... <samp>...,
      , or > ...


    5. ... ... ... ... ...

      Netscape extension the value for the size attribute can be a number from 1 to 7. the default is 3.

      ... <em>... ... ... <pre>... <samp>...
    6. <strong>.........

      ...

      ... ... ... ...
      or
    7. <em>... can be used only ... once inside ... ... ... <pre>... <samp>... <strong>... ... ...

      ... <em>... <strong> ... ... ...

      tells browser to emphasize enclosed text tells browser to place stronger emphasis on enclosed text a citation distinguishes text to be typed

      <samp> ...

      sample text

      ...

      renders text in monospaced

      ...



      emboldens enclosed text

      ...
      ... <em>... <strong>... ...

      ...
      ...

      t e x t

      to be displayed with spacing intact

      ...

      at the end of a document

      ...

      ...

      makes the text blink. use at your own risk.

      ...

      marks six of

      ...

      levels headings

      ...

      ...

      ...


      (1 is align=center (3.0) largest; 6 smallest)

      ... ... <em>...

      <strong>... ...

      code sample

      placeholder or variable for some other value

      ,
      ,


    8. <samp>...... >

      used to format, for example, signature files and/or copyright information

      ...

      ...

      <pre>...

      preformatted

      <pre>...

      ...

      ...

      typewriter font

      puts the text in italics

      ...

      ...

      ...
    9. or

      .........

      ...
      ... <pre>...
      ...
      ...
      or

      Refer to this chart if you plan to use special characters--machinereadable characters like , "quotation marks", & ampersands--in your text. Lists <>

      Netscape

        ...
        ...
      ...


    10. [...
    11. ]

      Tables

      allow you to create lists: 1. ordered,

      sets the type
      of marker (1, A, a,
    12. , for ordered ...
    13. and unordered i, disc, circle, ... lists; square) introducing
      or
    14. each list item
      ... start= overrides
      and
      unordered
    15. or for definition lists usual , or alphabetical/numer plain ical sequence of ordered lists opens an indented list item (with a number, in an ordered list, or a

      type=

      dir menu ol ul

      sets the type of marker (1, A, a, ... i, disc, circle, square) introducing
      em strong code samp kbd each list item var cite tt value= allows you ... i

      to set the number ol ul dir menu dl or letter of an bullet, in <pre>... ordered list item an

      unordered ...
      list) type=

      these tags mark the terms and definitions (respectively) in a definition list

      ...


      <>

      Netscape extensions: border= (width, in pixels, of the border to be drawn around the table. a value of FRAME will enclose just the outside of the table;
      ... BASIC, the border ... and cells) ... cellpadding= cell and the cell borders) cellspacing= (size of the lines dividing the data cells) width= (width in pixels or a percentage of the window)



      Specifies column properties in a table.

      ... ... ... ...... ...... ......
      ... or
    16. , (spacing between
      ...
      tion> the contents of the
    17. ...
      ...


      creates a table

      ...

      allows you to label a align=top, bottom table with a caption

      ...


      align=leftrightcente creates a r valign= ... or table row (top middle bottom ... baseline)

      ...


      ... . . . . . .

      creates a rowspan= data cell (the number of or header rows spanned by


      ...

      ...

      the cell) colspan= (the number of columns spanned by the cell) align= (left, right, center: horizontal alignment of the cell contents) valign= (top, cell in a middle, bottom: the table row vertical alignment of the cell contents) nowrap (indicates not to wrap the cell contents) width= (width in pixels or in a quoted percentage of the window)

      ... ol, ul, dir, menu, dl, pre,
      ...
      ...
      ... table

      Hypertext <>

      ...

      Images

      creates a link to another document or to another segment of the same document

      href="URL" or "file" or "#name" of subfile in the document name="name of subfile in this document" rel, rev, urn, title, methods


      <em>... <strong>... ... <samp>... ... ... ... ... ... ...

      ...
      ... b cite code
      ,
      or
    18. <em>... ... ... ... <pre>... <samp>... <strong>... ... ... ... or ...

      <>



      loads an inline image

      ismap= src= alt="text" Netscape extensions: align texttop/ absmiddle /baseline /bottom, vspace hspace width height border lowsrc="file to be loaded with the main document"

      ...
      ... ... cite code
      ,
      , or
    19. em ... i kbd p samp strong tt var

      creates a form

      action="URL" of script to process form input method="get" or "post" how the input will be sent to the gateway on the server side enctype= "application/ xwww-formurlencoded" only one value possible right now

      ...
      ...
      or
    20. ... or ...

      Forms <>

      ...


      ... p, lists, pre,
      ...
      , isindex table hr address input select textarea



      type="(checkbox/ hidden/ radio /reset /submit /text /image)" name="name of this item as passed to the script (in name/value pair)," value="default value (for text or hidden widget); value to be submitted with the form input (for a checkbox or radio button); widget or label (for Reset or Submit buttons)"
      ...
      for a form src="source file for an image",\ checked indicates that checkbox or radio button is checked size="size in chars of text widget" maxlength="no of characters in a text field" align="(texttop/ absmiddle /baseline /bottom,)" name=" (name to be passed to the multiline script as part of name/value pair)" text entry rows="no. of rows" widget cols="(no. of cols.)"

      ...


      <select>

      creates a menu or scrolling list of possible items

      ...