|
Instructional Module X23c
|
|
||
| |
|||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Layers and Dimensions
|
Layers allow us some control over the "third dimension" of our Web pages. In order understand layers, we need some vocabulary to discuss dimensions.
Web pages are fundamentally two-dimensional spaces, but when elements overlap, the third dimension comes into play. When do Web elements overlap?
Let's take a look at how objects overlap... |
||||||||||||
|
Setting Up Layers
|
Here's a table with two objects in it: a paragraph of text, and a blue ball. We'll place both objects so they overlap.
This illustrates two things:
The effect of code order can be illustrated if we put the same code with the paragraph first. Since this is relative positioning, we'll also have to swap the positioning attributes to get them in the same places.
When you want (or need) to control what's on top in some way other than with normal flow, there is a CSS attribute to handle it. Enter... z-index
Here's a sample of code that illustrates the use of z-index. We'll take the last example and set the z-index of the text paragraph higher than that of the image, so the text will be guaranteed to render in front of the image.
An example with more layers is shown in this associated file. Study the code through your browser's View > [Page] Source menu. |
||||||||||||
|
Try This
|
Here are four images. Save them onto your disk.
|
||||||||||||
| |
|
|---|---|
![]() |
Click here for review questions. |
| Audience |
This module is for people who are familiar with basic aspects of layout with Cascading Style Sheets (see module X22c) and want to learn about 3-D positioning and wrapping text around other elements on a page.
|
| Objectives | On successful completion of this module, you will be able to:
|
| Module X23c: Layers and Floating in CSS |
This document is part of a modular instruction
series in Computer Instruction. For more information, see the overview
or the list of modules in this series, X: XML, XHTML,
DHTML, CSS . This document has been used in the following classes: INP
270 .
|
| History |
Original: 27 March 2003, by Laurence J. Krieg
Last modification: Monday, 31-Aug-2009 11:48:08 EDT |
| Copyright |
Copyright © 2003, Laurence
J. Krieg, Washtenaw Community College Instructors: You may point to this file in your Web-based materials; however, its location may change without notice. Students: You are welcome to make a copy for your personal use. All other uses: Please contact the author, Laurence J. Krieg, for permission: krieg@ieee.org. |