Sizing, Positioning, and Modifying Layers with the Properties Inspector

Team-Fly    

Macromedia® DreamWeaver® MX Unleashed
By Matthew Pizzi, Zak Ruvalcaba
Table of Contents
Chapter 11.  Layers in Dreamweaver


After inserting content into a layer, you might need to resize it. For example, in Figure 11.10, you'll notice that I inserted an image into the layer; however, the layer is much larger than the graphic. With the layer selected, you can grab the bottom-right corner handle by clicking and dragging it all the way into the graphic. When you drag into the graphic and attempt to make the layer smaller than the content, the layer automatically resizes to the smallest possible size, not leaving an excess space around the graphic.

Figure 11.10. In this figure, the layer is much larger than the content inside it. Grab the handles on the side to resize the layer.

graphics/11fig10.jpg

To precisely resize the layer, you should use the Properties Inspector. With the layer selected, as shown in Figure 11.11, the Properties Inspector offers a host of options.

Figure 11.11. The Properties Inspector offers a series of options for manipulating the selected layer.

graphics/11fig11.jpg

If you have the dimensions of the image (if you don't, select it and the Properties Inspector provides you with the width and height information), you can size the layer to equal those dimensions. With the layer selected in the Properties Inspector, you can enter in a value for the width and height of the layer. Enter the values of the width and height from the image, and the layer will size perfectly around the graphic.

TIP

You can also resize the layer pixel-by-pixel by holding down the Command (Mac) key or Ctrl (Windows) key and simultaneously pressing an arrow in the direction that you want to increase or decrease the size of the layer.


Sizing Multiple Layers

Dreamweaver enables you to change the dimensions of more than one layer at a time. To select multiple layers, you can use a couple of options. The first is to hold down the Shift key on the keyboard as you click each of the layers in the document. Second, you can highlight the top layer in the Layers panel, and then hold down the Shift key and click the bottom layer in the panel; all the layers in between will be selected, as shown in Figure 11.12.

Figure 11.12. You can easily select multiple layers by holding down the Shift key while selecting layers in the Layers panel.

graphics/11fig12.jpg

After selecting more than one layer, you can resize them all through the Properties Inspector by entering values for the width and height. You also have the option of choosing Modify, Align, Make Same Height or Make Same Width. When you choose this option, the layers will size to the width and height of the first drawn layer, unless you've deleted it, in which case it will use the largest layer to size the rest of the layers.

Positioning Layers

There are many options for positioning layers outside of the CSS Style option we looked at earlier. The most obvious way is to click and drag the handle in the top-left corner of the layer. This enables you to place the layer anywhere you want, positioning it by eye. You can also select the layer and move it pixel-by-pixel with the arrow keys on the keyboard. However, if you want to be absolutely precise, you can set the layer's Left and Top coordinates through the Properties Inspector.

Positioning Layers Through the Properties Inspector

If you want to position a layer using the Properties Inspector, you can position the layer by adding values in the L and T options. The value you enter here represents a number relative to the document's top-left corner and the layer's top-left corner. For example, if you entered 0 in both spaces, the layer's top-left corner would be flush with the document's top-left corner. Add or subtract the number of pixels you want to move the layer toward or away from the top-left corner. If you type in negative values, the layer will be cropped by the document and some or all of the content will not be visible in a browser window.

Nesting Layers

You can easily place a layer inside another by nesting. The easiest way to nest a layer is to turn nesting on in the Preferences dialog box. You can access the Preferences dialog box by choosing Edit, Preferences. In the layers portion of the dialog box, be sure to select the Nesting option. With this option selected, if you draw a layer inside another, you're guaranteed that the layer will be nested inside the layer you're drawing into.

A nested layer is much like a nested table. The nested layer moves with the parent layer and it can inherit the parent's visibility attribute.

Nested layers sometimes yield unpredictable results in different Web browsers and will almost certainly choke many versions of Netscape.

Changing Attributes of a Layer

When a layer is selected, several options become available for that layer through the Properties Inspector, as shown in Figure 11.13.

Figure 11.13. The Properties Inspector offers several options for altering the appearance or properties of a layer.

graphics/11fig13.jpg

With all these options available, it may be confusing as to what they can offer in terms of altering the layer. Here's a small breakdown:

  • Layer ID Use this option to name the layer. Whatever you name your layer, that name can be used for communication with JavaScript or other behaviors. If you change the Layer ID in the Properties Inspector, it updates the Layers panel and vice versa. When naming layers, avoid spacing and special characters.

  • L and T Use these options to set the vertical and horizontal measurement for the location of the layer's top-left corner, relative to the top-left corner of the document.

  • W and H Type in a value for the dimensions of your layer size in width and height.

  • Z-Index This option determines how close or how far away a layer appears to the screen. The highest number is the topmost layer and the lowest number is the bottommost layer. You can set the z-index by typing a value into this text field or by using the Layers panel.

  • Vis The initial value for this is Default. Many browsers interpret this as visible; however, you might want to choose Visible from the drop-down menu, just to play it safe. You can also choose Hidden, which will make the layer invisible. The hidden choice is commonly used in conjunction with some behaviors. Refer to Chapter 19, "Behaviors," for more information on using layers with behaviors. Another option is available, called Inherit. This option is used for child layers nested inside parent layers. The nested layer will take on the same attributes as the parent. I discuss nested frames in greater detail later in this chapter.

  • BG Image This option is much like a table. You can set an image to appear behind the layer. If the image is smaller than the layer, it will repeat itself to create a tiled effect.

  • BG Color Like tables, you can use this option to set a background color for a layer.

  • Tag This option enables you to choose what HTML tag to use to create the layer. Internet Explorer 4 and later, as well as Netscape 6, can interpret the <div> and <span> tags for creating layers. Netscape 4 understands only <layer> and <ilayer> tags, which are no longer options in Dreamweaver MX. If you are designing specifically for Netscape 4.x, you'll have to hand code the tags.

  • Overflow and Clip These options are discussed in detail next.

Overflow

As you know, you can set an absolute size for a layer in the Properties Inspector. However, if you size the layer smaller than the content that is inside the layer, the overflow attribute will control how that content appears. There are four supported overflow attributes:

  • Visible This is the default setting. Visible will ignore the parameters you set for the width and height of the layer and automatically resize the layer to display all its contents.

  • Hidden This option crops the content that appears outside the specified dimensions so that it's not visible.

  • Scroll This makes horizontal and vertical scrollbars appear, regardless of the need for them.

  • Auto This option makes the horizontal and vertical scrollbars appear only if they are needed.

The Overflow attribute is supported by Internet Explorer 4.0 and later, as well as Netscape 6. It's also important to note that the Overflow option will not appear in the Dreamweaver MX authoring environment. You'll have to preview the page in a browser version just mentioned to see the results. Refer to Figure 11.14 to get an idea as to what the overflow attribute will look like when published.

Figure 11.14. Notice the differences between the overflow attributes. The attributes are visible only in the Web browser.

graphics/11fig14.jpg

Clipping

The Clipping option for layers is much like cropping an image in an image-editing program. However, the layer doesn't physically remove the excess image information; rather, the layer behaves like a mask, hiding the specified content.

In the Properties Inspector, you enter in values for the Left, Top, Right, and Bottom. All these value are measured from the layer's top-left corner. The values can be set to any unit accepted by the CSS standards, which include pixels (default), inches, centimeters, millimeters, ems, or picas.

Normally you'd type in a value for each of the options; however, you can use the word auto. Auto will set the Left and Top coordinates to 0,0, whereas auto in the Right and Bottom attributes will leave them virtually unchanged.

Use the Clipping Attribute

In this exercise you're going to crop the appearance of an image using the clipping attribute in the layer's Properties Inspector. Often it can be tricky as to what values you should enter in the Left, Top, Right, and Bottom attributes; however, you can use a temporary layer to help with finding those values. To precisely clip a layer, follow these steps:

  1. Draw or insert a new layer. After the layer is placed within the document, insert an image into that layer.

  2. Next you're going to draw a layer inside the existing layer. If you do not have nesting turned on in your preferences, hold down the Command (Mac) key or Ctrl (Windows) key while drawing the layer to turn nesting on temporarily. Draw the layer in the location in which you want to clip the image.

  3. Shift the layer around for precise placement. After having the layer positioned properly, write down the dimensions in the Properties Inspector for the Left, Top, Width, and Height.

  4. After you've jotted down the measurement values, delete the layer.

  5. Next, highlight the layer in which the image resides. In the clip values in the Properties Inspector, enter the same values that you copied from the temporary layer. Enter the Width and Height values you copied into the Right and Bottom options, respectively.

  6. As Figure 11.15 shows, the layer has masked out the portion of the image that was outside the original temporary layer.

    Figure 11.15. The image in the layer has been masked to display only the area that was inside the original temporary layer.

    graphics/11fig15.jpg


    Team-Fly    
    Top


    Macromedia Dreamweaver MX Unleashed
    Macromedia Dreamweaver MX 2004 Unleashed
    ISBN: 0672326310
    EAN: 2147483647
    Year: 2002
    Pages: 321

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net