When you first start Dreamweaver, your default Web page is untitled, with no background
image, and only a plain, white background. You can change any of these properties and more
through Dreamweaver’s Page Properties dialog box.
Attributes entered through the Page Properties dialog box are written into the <body> tag.
An increasing number of Web designers prefer to control these attributes through a
Cascading Style Sheet (CSS). For more information on CSS, see Chapter 20.
You can also change the document title in Dreamweaver’s Document toolbar. Just enter the
information in the Title field and press Enter (Return) to confirm the modification. You’ll see
the new title appear in the program’s title bar and whenever you preview the page in a
browser.
As usual, Dreamweaver gives you more than one method for accessing the Page Properties
dialog box. You can select Modify ➪ Page Properties, or you can use the keyboard shortcut
Ctrl+J (Command+J).
Here’s another way to open the Page Properties dialog box: Right-click (Control+click) any
open area in the Document window—that is, any part of the screen not occupied by an
image, table, or other object (text outside of tables is okay to click, however). From the
bottom of the context menu, select Page Properties.
Understanding <meta> and other <head> tags
Summary information about the content of a page—and a lot more—is conveyed through
<meta> tags used within the <head> section. The <meta> tag can be read by the server to
create a header file, which makes it easier for indexing software used by search engines to
catalog sites. Numerous different types of <meta> tags exist, and you can insert them in your
document just like other objects.
One <meta> tag is included by default in every Dreamweaver page. The Document Encoding
option of the Page Properties dialog box determines the character set used by the current
Web page and is displayed in the <head> section as follows:
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1”>
The preceding <meta> tag tells the browser that this page is, in fact, an HTML page and that the
page should be rendered using the specified character set (the charset attribute). The key
attribute here is http-equiv, which is responsible for generating a server response header.
Once you’ve determined your <meta> tags for a Web site, the same basic <meta> information
can go on every Web page. Dreamweaver gives you a way to avoid having to insert the
same lines repeatedly: templates. Once you’ve set up the <head> elements the way you’d
like them, choose File ➪ Save As Template. If you want to add <meta> or any other <head>
tags to an existing template, you can edit the template and then update the affected pages.
For more information about templates, turn to Chapter 28.
In Dreamweaver, you can insert a <meta> tag or any other tag using the <head> tag objects,
which you access via the Head category in the Insert bar or the Insert ➪ Head Tags menu
option. The <head> tag objects are described in Table 6-1 and subsequent subsections.
Table 6-1: Head Tag Objects
Object Description
Meta Inserts information that describes or affects the entire document
Keywords Includes a series of words used by some search engines to index the current Web
page and/or site
Description Includes a text description of the current Web page and/or site
Refresh Reloads the current document or loads a new URL within a specified number of
seconds
Base Establishes a reference for all other URLs in the current Web page
Link Inserts a link to an external document, such as a style sheet
Cross-
Reference
Cross-
Reference
226 Part II ✦ Web Design and Layout
Inserting tags with the Meta object
The Meta object is used to insert tags that provide information for the Web server, through
the HTTP-equiv attribute, and other overall data that you want to include in your Web page
but not make visible to the casual browser. Some Web pages, for example, have built-in expiration
dates after which the content is to be considered outmoded. In Dreamweaver, you can
use the Meta object to insert a wide range of descriptive data.
You can access the Meta object in the Head category of the Insert bar or via the Insert menu
by choosing Insert ➪ Head Tags ➪ Meta. Like all the Head objects, you don’t have to have the
Head Content visible to insert the Meta object; although you do have to choose View ➪ Head
Content if you wish to edit the object. To insert a Meta object, follow these steps:
1. Select Insert ➪ Head Tags ➪ Meta or select the Meta object from the Head category of
the Insert bar. Your current cursor position is irrelevant.
The Meta dialog box opens, as shown in Figure 6-3.
Figure 6-3: The Meta object enables you to enter a full range of <meta> tags in the
<head> section of your Web page.
Meta dialog box
Meta icon
Chapter 6 ✦ Accessing the Code Directly 227
2. Choose the desired attribute: Name or an HTTP equivalent from the Attribute list box.
Press Tab.
3. Enter the value for the selected attribute in the Value text box. Press Tab.
4. Enter the value for the content attribute in the Content text box.
5. Click OK when you’re done.
You can add as many Meta objects as you need to by repeating Steps 1 through 4. To edit an
existing Meta object, you must first choose View ➪ Head Content to reveal the <head> code,
indicated by the various icons. Select the Meta icon and make your changes in the Property
inspector.
Aiding search engines with the Keywords and Description objects
Let’s take a closer look at the tags that convey indexing and descriptive information to some
search engine spiders. These chores are handled by the Keywords and Description objects.
As noted in the sidebar, “Built-in Meta Commands,” the Keywords and Description objects
output specialized <meta> tags.
Both objects are straightforward to use. Choose Insert ➪ Head Tags ➪ Keywords or Insert ➪
Head Tags ➪ Description. You can also choose the corresponding objects from the Head category
of the Insert bar. Once selected, these objects open similar dialog boxes with a single
entry area, a large text box, as shown in Figure 6-4. Enter the values—whether keywords or a
description—in the text box and click OK when you’re done. You can edit the Keywords and
Description objects, like the Meta object, by selecting their icons in the Head area of the
Document window, revealed by choosing View ➪ Head Contents.
Although you can enter paragraph returns in your Keywords and Description objects, there’s
no reason to. Browsers ignore all such formatting when processing your code.
Built-in Meta Commands
Although Dreamweaver presents six different Head objects, <meta> tags form the basis of four of
them: Meta, Keywords, Description, and Refresh. By specifying different name attributes, the purpose
of the <meta> tags changes. For example, a Keywords object uses the following format:
<meta name=”keywords” content=”dreamweaver, web, authoring, Æ
HTML, DHTML, CSS, Macromedia”>
whereas a Description object inserts this type of code:
<meta name=”description” content=”This site is devoted to Æ
extensions made possible by Macromedia’s Dreamweaver, the Æ
premier Web authoring tool.”>
It is possible to create all your <meta> tags with the Meta object by specifying the name attribute
and giving it the pertinent value, but it’s easier to just use the standard Dreamweaver Head
objects.
228 Part II ✦ Web Design and Layout
Figure 6-4: Entering information through the Keywords object helps search engines
correctly index your Web page.
What you place in the Keywords and Description objects can have a big impact on your Web
page’s accessibility. If, for example, you want to categorize your Web page as an homage to
the music of the early seventies, you could enter the following in the Content area of the
Keywords object:
music, 70s, 70’s, eagles, ronstadt, bee gees, pop, rock
In the preceding case, the content list is composed of words or phrases, separated by commas.
Use sentences in the Description object, as follows:
The definitive look back to the power pop rock stylings of early 1970s
music, with special sections devoted to the Eagles, Linda Ronstadt, and
the Bee Gees.
Keep in mind that the content in the Description should complement and extend both the
Keywords and the Web page title. You have more room in both the Description and Keywords
objects—actually, an unlimited amount—than in the page title, which should be on the
short side in order to fit into the browser’s title bar.
When using <meta> tags with the Keywords or Description objects, don’t stuff the <meta>
tags repeatedly with the same word. The search engines are engineered to reject multiple
instances of the same words, and your description will not get the attention it deserves.
Refreshing the page and redirecting users
The Refresh object forces a browser to reload the current page or to load a new page after a
user-set interval. The Web page visitor usually controls refreshing a page; if, for some reason,
the display has become garbled, the user can choose Reload or Refresh from the menu to
redraw the screen. Impatient Web surfer that I am, I often stop a page from loading to see
what text links are available and then—if I don’t see what I need—hit Reload to bring in the
full page. The code inserted by the Refresh object tells the server, not the browser, to reload
the page. This can be a powerful tool but leads to trouble if used improperly.
To insert a Refresh object, follow these steps:
1. Choose Insert ➪ Head Tags ➪ Refresh or select the Insert Refresh object from the Head
category of the Insert bar.
The Refresh dialog box, shown in Figure 6-5, opens.
Figure 6-5: Use the Refresh object to redirect visitors from an outdated page.
Refresh dialog box
Refresh icon
Caution
230 Part II ✦ Web Design and Layout
2. Enter the number of seconds you want to wait before the Refresh command takes effect
in the Delay text box.
The Delay value is calculated from the time the page finishes loading.
3. Select the desired Action:
• Go to URL
• Refresh This Document
4. If you selected Go to URL, enter a path to another page in the text box or select the
Browse button to select a file.
5. Click OK when you’re done.
The Refresh object is most often used to redirect a visitor to another Web page. The Web is a
fluid place, and sites often move from one address to another. Typically, a page at the old
address contains the Refresh code that automatically takes the user to the new address. It’s
good practice to include a link to your new URL on the “change-of-address” page because not
all browsers support the Refresh option. One other tip: Keep the number of seconds to a
minimum—there’s no point in waiting for something to happen automatically when you
could click a link.
If you elect to choose the Refresh This Document option, use extreme caution, for several
reasons. First, you can easily set up an endless loop for your visitors in which the same page
is constantly being refreshed. If you are working with a page that updates often, enter a
longer Refresh value, such as 300 or 500. You should be sure to include a link to another
page to enable users to exit from the continually refreshed page. You should also be aware
that many search engines will not index pages using the <meta> refresh tag because of
widespread abuse by certain industries on the Web.
Changing bases
Through the Base object, the <head> section enables you to exert fundamental control over
the basic HTML element: the link. The code inserted by this object specifies the base URL for
the current page. If you use relative addressing (covered in Chapter 9), you can switch all
your links to another directory—even another Web site—with one command. The Base
object takes two attributes: Href, which redirects all the other relative links on your page;
and target, which specifies where the links will be rendered.
To insert a Base object in your page, follow these steps:
1. Choose Insert ➪ Head Tags ➪ Refresh or select the Base object from the Head category
of the Insert bar.
The Base dialog box opens.
2. Input the path that you want all other relative links to be based on in the Href text box
or choose the Browse button to pick the path.
3. If desired, enter a default target for all links without a specific target to be rendered in
the Target text box.
4. Click OK when you’re done.
Caution
Chapter 6 ✦ Accessing the Code Directly 231
How does a <base> tag affect your page? Suppose you define one link as follows:
images/backgnd.gif
Normally, the browser looks in the same folder as the current page for a subfolder named
images. A different sequence occurs, however, if you set the <base> tag to another URL in
the following way:
<base href=”http://www.testsite.com/client-demo01/”>
With this <base> tag, when the same images/backgnd.gif link is activated, the browser
looks for its file in the following location:
http://www.testsite.com/client-demo01/images/backgnd.gif
Because of the all-or-nothing capability of <base> tags, many Webmasters use them
cautiously, if at all.
Linking to other files
The Link object indicates a relationship between the current page and another page or file.
Although many other intended uses exist, the <link> tag is most commonly used to apply an
external Cascading Style Sheet (CSS) to the current page. This code is entered automatically
in Dreamweaver when you create a new linked style sheet (as described in Chapter 20), or
you can add the attributes yourself with the Link object. The <link> tag is also used to
include TrueDoc dynamic fonts.
One other popular use of the <link> tag is to create favicons. A favicon is a small icon that
appears in the Favorites menu of Internet Explorer browsers when you mark a site as a
Favorite or bookmarked. To have a favicon appear when a page is bookmarked, create a favicon
using one of the tools listed at www.favicon.com and upload that image file to your
site. Then put a tag like this on your page:
<LINK REL=”SHORTCUT ICON” HREF=”/images/fav.ico”>.
where fav.ico is the name of the icon file, here stored in the images folder at the root of the site.
To insert a Link object, first choose Insert ➪ Head Tags ➪ Link or select the Insert Link object
from the Head category of the Insert bar. This action opens the Link dialog box.
Attribute Description
Href The path to the file being linked. Use the Browse button to open the Select File
dialog box.
ID The ID attribute can be used by scripts to identify this particular object and affect
it if need be.
Title The Title attribute is displayed as a ToolTip by Internet Explorer browsers.
Rel A keyword that describes the relationship of the linked document to the current
page. For example, an external style sheet uses the keyword stylesheet.
Rev Rev, like Rel, also describes a relationship but in the reverse. For example, if
home.html contained a link tag with a Rel attribute set to intro.html, intro.html
could contain a link tag with a Rev attribute set to home.html.
Aside from the style sheet use, there’s little browser support for the other link functions.
However, the World Wide Web Consortium (W3C) supports an initiative to use the <link>
tag to address other media, such as speech synthesis and Braille devices, and it’s entirely
possible that the Link object will be used for this purpose in the future.
Adding to the <body>
The content of a Web page—the text, images, links, and plugins—is all contained in the
<body> section of an HTML document. The great majority of <body> tags can be inserted
through Dreamweaver’s visual layout interface.
To use the <body> tags efficiently, you need to understand the distinction between logical
styles and physical styles used in HTML. An underlying philosophy of HTML is to keep the
Web as universally accessible as possible. Web content is intended to be platform- and
resolution-independent, but the content itself can be styled by its intent as well. This
philosophy is supported by the existence of logical <body> tags (such as <code> and
<cite>), with which a block of text can be rendered according to its meaning, and physical
style tags for directly italicizing or underlining text. HTML enables you to choose between
logical styles, which are relative to the text, or physical styles, which can be regarded as
absolute.
No comments:
Post a Comment