untitled

(John Hannent) #1

Relativity Explained ......................................................................................


Relativepositioning means that an element is located in terms of another
element.

Relative location might mean an element is centered in the middle of the other
element, or 35 pixels to its left, or 25 percent down from its top. The main point
is that the first element’s position depends on the other element’s location. As
you saw in Figure 4-3, a headline can be centered relative to the browser window.

Absolute positioning specifies a particular number(pixels, points, inches,
whatever measurement system you choose) by which the element should be
positioned. Absolute size is described by width and height numbers, as in the
picture size described in the HTML code earlier in this chapter:

<IMG height=”292” width=”448” src=”lake.jpg” >

Absolute position is described by two numbers: the top and left. Technically
called coordinates, these two numbers tell the browser exactly where to put
the element within the browser’s window. Top 3 inchesmeans put the top
of the element three inches down from the browser window frame. Left 2
inchesmeans two inches over from the left side of the frame. Using these
two coordinates, you can put anything, anywhere.

Some designers try to make their Web pages extremely flexible so that they
can be viewed in many different sizes — from tiny PDA screens to gigantic
stadium screens. This is another reason to use relative size and position tech-
niques. Notice that when you choose View➪Text Size in Internet Explorer,
you are shown relativistic options: largest, larger, medium, smaller, smallest.
You don’t see choices like 1 inch, 1/2 inch, 1/4 inch, and so on, which are
absolute specs. The people who designed Internet Explorer assumed that
people are using different-size screens with different resolutions settings
(800x600 and others). So the meaning of “large” should be relative to the res-
olution, not some fixed (absolute) unit of measurement. What’s largest on a
PDA is quite a different size from what’s largest on a Jumbotron, right?

Of course, as Albert Einstein pointed out, everythingis relative except the
speed of light. So, when we speak of “absolute” positioning, it merely means
that we’re being somewhat “less relative.” What do I mean by this?

You actually cannot sit still, no matter how hard you try. When you think you’re
sitting still, you’re still moving at about a half million miles per hour as the solar
system spins around the galaxy. In fact, you’re moving through space in a rapid
and complex corkscrew path. Even while you’re quietly asleep, you’re still flying
aboard the rotating earth, orbiting the sun, spinning around the galaxy. And the
galaxy itself is hurtling through the universe. So you’re moving really fast in a
dozen different circles all the time. Luckily, so is your bed and everything else
in your room. They’re all at rest, relative to you, but not relative to light.

72 Part II: Looking Good with CSS

Free download pdf