Formatting web page

G

Guest

I am using layers on my web page and when published I have a problem with the
browser moving the layers when the browser is resized. For example, if I
have layers on the left hand side, and I resize my browser, the layers on the
left push over to the right hand side. Is there any way to make these layers
stationary? I want to be able to resize a web page and have the page content
remain in the same positions on the page as the browser is resized.
 
R

Ronx

If the layers are inserted correctly, they do not move - the rest of
the page moves around them. If they are incorrectly inserted -
example in a table cell - then move them so that they are immediately
after the <body> tag, or immediately before the </body> tag. If
inserted in the page in this fashion you lose any control over their
position.
Layers use absolute positioning, which, when correctly used, does not
move around the page.

A link to the page will help give better advice.
 
G

Guest

I apologize for not responding earlier - I was away. It appears that the
layers ar enot movie, but the original page (not layerd) is moving. Try
http://www.phwedigital.com/Katlyn.htm and when the browser is made smaller
the layers stay where they are, but everything else moves underneath the
layers as the browser size gets smaller.
 
M

Murray

The simple way would be to change every instance of -

<p align="center">

to -

<p>

in your code.
 
M

Murray

I see - you're right.

OK - change this -

</head>

<body background="images/pray_for_peace_trs2_me.jpg"
style="background-attachment: fixed">

to this -

<style type="text/css">
<!--
body { text-align:center; }
#wrapper { text-align:left; width:760px; position:relative; margin: 0
auto; }
-->
</style>
</head>
<body background="images/pray_for_peace_trs2_me.jpg"
style="background-attachment: fixed">
<div id="wrapper">

and this -

</body>

to this -

</div><!-- /wrapper -->
</body>

and see what happens.
 
G

Guest

Thanks Murray... it worked and I really appreciate your help.. So now, what
did this code change do? Could I have done anything while creating the page
in Front Page during my initial setup? Or will I have to figure out where to
add this code in each page.
 
M

Murray

It's a simple solution for a not so simple reason.

Your problem was caused by electing to use 'layers' for the left hand
elements and centering for the images. This is a fatal decision for one not
skilled in web work since it means that part of your page will move (the
images), and part of your page will not (the layers).

There are two solutions to this problem -

1. To get rid of the layers, and use only tables for everything. That way,
all of your content is within a center table (or tables), and it all moves
in concert.

2. To use a knowledge of how absolute positioning works, and change the
frame of reference of those layers from the top left of the page to the top
left of a 'parent' centering container.

We did the latter. The concept is this -

1. Use CSS to define centering properties on the container (the div with
the id of 'wrapper') - to make it center, we had to give it a width, and
specify 'auto' margins left and right. Since we know the width of the
browser viewport, and we know the width of the container, we can calculate
how much margin to use on the left and on the right and that's what the
browser does.

2. Use CSS to position that div in such a way that it becomes the parent
positioned element for the 'layers' that you have used on the page. Since
that element is now a centering element, when it centers, it drags the
'child' layers along with it (as well as the table). To do this, all you
need to do is to make the container div ('wrapper') have
"position:relative".

3. Add the opening tag for the container div immediately below <body>, and
the closing tag for the container immediately above </body>, so that the
entire page is contained within it.

4. Add some tricks to kick IE in the pants and remind it that it should
center align things - that's the text-align:center part of the CSS. Then
add another trick to revert the alignment back to what you wanted in the
first place (that's the text-align:left part).

Did I lose you?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top