A.6. Page Layout PropertiesThe following properties control the placement and size of elements on a Web page. A.6.1. bottomThis property is used with absolute, relative , and fixed positioning (see Section A.1.1). When used with absolute or fixed positioning, bottom determines the position of the bottom edge of the style relative to the bottom edge of its closest positioned ancestor . If the styled element isn't inside of any positioned tags, then the placement is relative to the bottom edge of the browser window. You can use this property to place a footnote at the bottom of the browser window. When used with relative positioning, the placement is calculated from the element's bottom edge (prior to positioning). See Section 12.1.2.
Note: Internet Explorer 6 and earlier can have a problem when positioning an element using the bottom property. See Section 12.1.4 for details. A.6.2. clearPrevents an element from wrapping around a floated element. Instead, the cleared element drops below the bottom of the floated element.
A.6.3. clipCreates a rectangular window that reveals part of an element. If you had a picture of your high-school graduating class, and the class bully was standing on the far right edge of the photo, you could create a display area that crops out the image of your tormentor. The full image is still intact, but the clipping area only displays the bully free portion of it. The clip property is most effective when used with JavaScript programming to animate the clip. You can start with a small clipping area and expand it until the full photo is revealed.
Tip: Since the order of the coordinates is a little strange , most designers like to start with the first and last numbers, and then compute the two other numbers from them. A.6.4. displayDetermines the kind of box used to display a page elementblock-level or inline (Section 7.2.4). Use it to override how a browser usually displays a particular element. You can make a paragraph (block-level element) display without line breaks above and below itexactly like, say, a link (inline element).
A.6.5. floatMoves ( floats) an element to the left or right edge of the browser window, or, if the floated element's inside another element, to the left or right edge of that containing element. Elements that appear after the floated element move up to fill the space to the right (for left floats) or left (for right floats), and then wrap around the floated element. Use floats for simple effects, like moving an image to one side of the page, or for very complex layouts like those described in Chapter 11.
A.6.6. heightSets the height of the content area the area of an element's box that contains content like text, images, or other tags. The element's actual onscreen height is the total of height, top and bottom margins, top and bottom padding, and top and bottom borders.
Note: Sometimes, your content ends up taller than the set heightif you type a lot of text, for instance, or your visitor increases text size in her browser. Browsers handle this situation differently: IE 6 and earlier simply make the box bigger, while other browsers make the content extend outside of the box. The overflow property controls what happens in this case (see Section 7.5.2). A.6.7. leftWhen used with absolute or fixed positioning (Section 12.1), this property determines the position of the left edge of the style relative to the left edge of its closest positioned ancestor. If the styled element isn't inside of any positioned tags, then the placement is relative to the left edge of the browser window. You can use this property to place an image 20 pixels from the left edge of the browser window. When used with relative positioning, the placement is calculated from the element's left edge (prior to positioning).
A.6.8. max-heightSets the maximum height for an element. That is, the element's box may be shorter than this setting, but it can't be any taller. If the element's contents are taller than the max-height setting, they overflow the box. You can control what happens to the excess using the overflow property (Section 7.5.2). Internet Explorer 6 (and earlier) doesn't understand the max-height property.
A.6.9. max-widthSets the maximum width for an element. The element's box can be narrower than this setting, but no wider. If the element's contents are wider than the max-width setting, they overflow the box, which you can control with the overflow property ( Section 7.5.2). You mostly use max-width in liquid layouts (Section 11.1) to make sure a page design doesn't become unreadably wide on very large monitors . This property doesn't work in Internet Explorer 6 (or in earlier versions).
A.6.10. min-heightSets the minimum height for an element. The element's box may be taller than this setting, but it can't be shorter. If the element's contents aren't as tall as the min-height setting, the box's height shrinks to meet the min-height value. Internet Explorer 6 (and earlier) doesn't recognize this property.
A.6.11. min-widthSets the minimum width for an element. The element's box may be wider than this setting, but it can't be narrower. If the element's contents aren't as wide as the min-width value, the box simply gets as thin as the min-width setting. You can also use min-width in liquid layouts, so that the design doesn't disintegrate at smaller window widths. When the browser window is thinner than min-width , it adds horizontal scroll bars. Internet Explorer 6 (and earlier) doesn't understand this property.
Note: You usually use the max-width and min-width properties in conjunction when creating liquid layouts. See Chapter 11 (Section 11.4.3). A.6.12. overflowDictates what should happen to text that overflows its content area, like a photo that's wider than the value set for the width property. Note: IE 6 (and earlier) handles overflow situations differently than other browsers. See Section 7.5.2.
A.6.13. positionDetermines what type of positioning method a browser uses when placing an element on the page.
Note: You usually use relative, absolute , and fixed in conjunction with left, right, top , and bottom . See Chapter 12 for the full details on positioning. A.6.14. rightWhen used with absolute or fixed positioning (Section 12.1), this property determines the position of the right edge of the style relative to the right edge of its closest positioned ancestor. If the styled element isn't inside of any positioned tags, then the placement is relative to the right edge of the browser window. You can use this property to place a sidebar a set amount from the right edge of the browser window. When used with relative positioning, the placement is calculated from the element's right edge (prior to positioning).
Note: Internet Explorer 6 (and earlier) can have problems when positioning an element using the right property. See Section 12.1.4 for details. A.6.15. topDoes the opposite of the bottom property (Section A.1.1). In other words, when used with absolute or fixed positioning, this property determines the position of the top edge of the style relative to the top edge of its closest positioned ancestor. If the styled element isn't inside of any positioned tags, then the placement is relative to the top edge of the browser window. You can use this property to place a logo a set amount from the top edge of the browser window. When used with relative positioning, the placement is calculated from the element's top edge (prior to positioning).
A.6.16. visibilityDetermines whether a Web browser displays the element. Use this property to hide part of the content of the page, such as a paragraph, headline, or <div> tag. Unlike the display property's none valuewhich hides an element and removes it from the flow of the pagethe visibility property's hidden option doesn't remove the element from the page flow. Instead, it just leaves an empty hole where the element would have been. For this reason, you most often use the visibility property with absolutely positioned elements, which have already been removed from the flow of the page. Hiding an element doesn't do you much good unless you can show it again. JavaScript programming is the most common way to toggle the visibility property to show and hide items on a page. You can also use the :hover pseudo-class (Section 9.1) to change an element's visibility property when a visitor hovers over some part of the page.
A.6.17. widthSets the width of the content area (the area of an element's box that contains text, images, or other tags). The amount of onscreen space actually dedicated to the element may be much wider, since it includes the width of the left and right margin, left and right padding, and left and right borders. IE 6 (and earlier) handles overflow situations differently than other browsers. (See Section 7.5.2.)
A.6.18. z-indexControls the layering of positioned elements. Only applies to elements with a position property set to absolute, relative , or fixed ( Section 12.1). It determines where on the Z-axis an element appears. If two absolutely positioned elements overlap, the one with the higher z-index appears to be on top.
Tip: The values don't need be in exact integer order. If element A has a z-index of 1 , you don't have to set element B's z-index to 2 to put it on top. You can use 5, 10 , and so on to get the same effect, as long as it's a bigger number. So, to make sure an element always appears above other elements, simply give it a very large value, like 10000 . |