how to centre my web page using layers?

D

Daisy

i love the use of layers in fp2003 as i have lots of images and descriptions
on my pages, but how can i get them to sit in the middle of the page when
viewed at 600x800 as well as 1024x768. If i use tables alone, then i
assume i just make the table 100% to suit any view, but how to do this with
layers

any help greatly appreciated.

daisy
 
M

Mark Fitzpatrick

Daisy,
Your best way is actually to use a table. What most individuals do
now who want a centered approach is to define a table of a certain size,
most commonly about 750 (that way it fits an 800x600 monitor with room on
the side for the scrollbar), then set the table alignment to center. This
gives you the most consistant approach and also degrades nicely for non-IE
users. To do it with layers is trickier because layers tend to be defined in
absolute position or relative to an object. The best way is to get them into
the table and try to make them relative to the table cell that they're in.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
J

Jon

Tables shouldn't go in layers - better to use 1 or the other. To centre a
layer(div) code would go like this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
#centerDiv {
width: 750px;
background-color: red;
margin: 0 auto;
}
</style>
<!--[if IE 5]>
<style>
body {text-align: center;}
#centerDiv {text-align left;}
</style>
<![endif]-->
</head>
<body>
<div id="centerDiv">
This div will be centred 750px wide
</div>

A couple of notes you must have a full doctype on the page for this to work,
also keep the conditional comment for IE5 support as IE5 doesn't support
margin:auto so we need to work around

Jon
Microsoft MVP - FP
 
C

chris leeds

absolutely!
I struggled with all that table-less stuff for weeks and never felt it was
"ready for prime time". there were limitations that were too difficult to
try to overcome.
at least with the tables your layout is iron-clad and you've got all these
<td>'s to class and id. ;-)
IMHO
 
J

Jon

meant to say this the other way around - layers shouldn't go in tables :)

Jon said:
Tables shouldn't go in layers - better to use 1 or the other. To
centre a layer(div) code would go like this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
#centerDiv {
width: 750px;
background-color: red;
margin: 0 auto;
}
</style>
<!--[if IE 5]>
<style>
body {text-align: center;}
#centerDiv {text-align left;}
</style>
<![endif]-->
</head>
<body>
<div id="centerDiv">
This div will be centred 750px wide
</div>

A couple of notes you must have a full doctype on the page for this
to work, also keep the conditional comment for IE5 support as IE5
doesn't support margin:auto so we need to work around

Jon
Microsoft MVP - FP


Mark said:
Daisy,
Your best way is actually to use a table. What most
individuals do now who want a centered approach is to define a table
of a certain size, most commonly about 750 (that way it fits an
800x600 monitor with room on the side for the scrollbar), then set
the table alignment to center. This gives you the most consistant
approach and also degrades nicely for non-IE users. To do it with
layers is trickier because layers tend to be defined in absolute
position or relative to an object. The best way is to get them into
the table and try to make them relative to the table cell that
they're in.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
C

Crash Gordon

so much for progress huh.



| absolutely!
| I struggled with all that table-less stuff for weeks and never felt it was
| "ready for prime time". there were limitations that were too difficult to
| try to overcome.
| at least with the tables your layout is iron-clad and you've got all these
| <td>'s to class and id. ;-)
| IMHO
|
| --
| The email address on this posting is a "black hole". I got tired of all the
| spam.
| Please feel free to contact me here:
| http://nedp.net/contact/
| --
|
|
| | > Daisy,
| > Your best way is actually to use a table. What most individuals do
| > now who want a centered approach is to define a table of a certain size,
| > most commonly about 750 (that way it fits an 800x600 monitor with room on
| > the side for the scrollbar), then set the table alignment to center. This
| > gives you the most consistant approach and also degrades nicely for non-IE
| > users. To do it with layers is trickier because layers tend to be defined
| in
| > absolute position or relative to an object. The best way is to get them
| into
| > the table and try to make them relative to the table cell that they're in.
| >
| > Hope this helps,
| > Mark Fitzpatrick
| > Microsoft MVP - FrontPage
| >
| > | > > i love the use of layers in fp2003 as i have lots of images and
| > descriptions
| > > on my pages, but how can i get them to sit in the middle of the page
| when
| > > viewed at 600x800 as well as 1024x768. If i use tables alone, then i
| > > assume i just make the table 100% to suit any view, but how to do this
| > with
| > > layers
| > >
| > > any help greatly appreciated.
| > >
| > > daisy
| > >
| > >
| >
| >
|
|
 
C

chris leeds

don't get me wrong, I wouldn't do a site and NOT use a style sheet. it's
just that I can't see much (I know about the semantic markup and
accessibility) that would make me abandon the solidity of tables. plus
tables give you plenty of good opportunities to style large blocks of
content just because of their structure.

--
The email address on this posting is a "black hole". I got tired of all the
spam.
Please feel free to contact me here:
http://nedp.net/contact/
--


so much for progress huh.



| absolutely!
| I struggled with all that table-less stuff for weeks and never felt it was
| "ready for prime time". there were limitations that were too difficult to
| try to overcome.
| at least with the tables your layout is iron-clad and you've got all these
| <td>'s to class and id. ;-)
| IMHO
|
| --
| The email address on this posting is a "black hole". I got tired of all
the
| spam.
| Please feel free to contact me here:
| http://nedp.net/contact/
| --
|
|
| | > Daisy,
| > Your best way is actually to use a table. What most individuals
do
| > now who want a centered approach is to define a table of a certain size,
| > most commonly about 750 (that way it fits an 800x600 monitor with room
on
| > the side for the scrollbar), then set the table alignment to center.
This
| > gives you the most consistant approach and also degrades nicely for
non-IE
| > users. To do it with layers is trickier because layers tend to be
defined
| in
| > absolute position or relative to an object. The best way is to get them
| into
| > the table and try to make them relative to the table cell that they're
in.
| >
| > Hope this helps,
| > Mark Fitzpatrick
| > Microsoft MVP - FrontPage
| >
| > | > > i love the use of layers in fp2003 as i have lots of images and
| > descriptions
| > > on my pages, but how can i get them to sit in the middle of the page
| when
| > > viewed at 600x800 as well as 1024x768. If i use tables alone, then i
| > > assume i just make the table 100% to suit any view, but how to do this
| > with
| > > layers
| > >
| > > any help greatly appreciated.
| > >
| > > daisy
| > >
| > >
| >
| >
|
|
 
C

Crash Gordon

i don't understand css yet, so it's tables fer me...also im still using 2002


| don't get me wrong, I wouldn't do a site and NOT use a style sheet. it's
| just that I can't see much (I know about the semantic markup and
| accessibility) that would make me abandon the solidity of tables. plus
| tables give you plenty of good opportunities to style large blocks of
| content just because of their structure.
|
| --
| The email address on this posting is a "black hole". I got tired of all the
| spam.
| Please feel free to contact me here:
| http://nedp.net/contact/
| --
|
|
| | so much for progress huh.
|
|
|
| | | absolutely!
| | I struggled with all that table-less stuff for weeks and never felt it was
| | "ready for prime time". there were limitations that were too difficult to
| | try to overcome.
| | at least with the tables your layout is iron-clad and you've got all these
| | <td>'s to class and id. ;-)
| | IMHO
| |
| | --
| | The email address on this posting is a "black hole". I got tired of all
| the
| | spam.
| | Please feel free to contact me here:
| | http://nedp.net/contact/
| | --
| |
| |
| | | | > Daisy,
| | > Your best way is actually to use a table. What most individuals
| do
| | > now who want a centered approach is to define a table of a certain size,
| | > most commonly about 750 (that way it fits an 800x600 monitor with room
| on
| | > the side for the scrollbar), then set the table alignment to center.
| This
| | > gives you the most consistant approach and also degrades nicely for
| non-IE
| | > users. To do it with layers is trickier because layers tend to be
| defined
| | in
| | > absolute position or relative to an object. The best way is to get them
| | into
| | > the table and try to make them relative to the table cell that they're
| in.
| | >
| | > Hope this helps,
| | > Mark Fitzpatrick
| | > Microsoft MVP - FrontPage
| | >
| | > | | > > i love the use of layers in fp2003 as i have lots of images and
| | > descriptions
| | > > on my pages, but how can i get them to sit in the middle of the page
| | when
| | > > viewed at 600x800 as well as 1024x768. If i use tables alone, then i
| | > > assume i just make the table 100% to suit any view, but how to do this
| | > with
| | > > layers
| | > >
| | > > any help greatly appreciated.
| | > >
| | > > daisy
| | > >
| | > >
| | >
| | >
| |
| |
|
|
 
D

Daisy

thanks everyone, suppose ill have to continue using tables. i do find them
a pain though and a bit restrictive on the creative side. I mightl try the
idea of creating a table and then using relative positioning of layers to
see what happens.

As a second thought, i suppose i could import the page into Dreamweaver and
then convert layers to tables and then set the properties of the table to be
centred and a set size and then either keep the web page like that or even
convert the page back to layers in case i want to amend them later!!
Phew! - i think ill just stick to tables.

Thanks

Daisy


i don't understand css yet, so it's tables fer me...also im still using 2002


| don't get me wrong, I wouldn't do a site and NOT use a style sheet. it's
| just that I can't see much (I know about the semantic markup and
| accessibility) that would make me abandon the solidity of tables. plus
| tables give you plenty of good opportunities to style large blocks of
| content just because of their structure.
|
| --
| The email address on this posting is a "black hole". I got tired of all
the
| spam.
| Please feel free to contact me here:
| http://nedp.net/contact/
| --
|
|
| | so much for progress huh.
|
|
|
| | | absolutely!
| | I struggled with all that table-less stuff for weeks and never felt it
was
| | "ready for prime time". there were limitations that were too difficult
to
| | try to overcome.
| | at least with the tables your layout is iron-clad and you've got all
these
| | <td>'s to class and id. ;-)
| | IMHO
| |
| | --
| | The email address on this posting is a "black hole". I got tired of all
| the
| | spam.
| | Please feel free to contact me here:
| | http://nedp.net/contact/
| | --
| |
| |
| | | | > Daisy,
| | > Your best way is actually to use a table. What most
individuals
| do
| | > now who want a centered approach is to define a table of a certain
size,
| | > most commonly about 750 (that way it fits an 800x600 monitor with room
| on
| | > the side for the scrollbar), then set the table alignment to center.
| This
| | > gives you the most consistant approach and also degrades nicely for
| non-IE
| | > users. To do it with layers is trickier because layers tend to be
| defined
| | in
| | > absolute position or relative to an object. The best way is to get
them
| | into
| | > the table and try to make them relative to the table cell that they're
| in.
| | >
| | > Hope this helps,
| | > Mark Fitzpatrick
| | > Microsoft MVP - FrontPage
| | >
| | > | | > > i love the use of layers in fp2003 as i have lots of images and
| | > descriptions
| | > > on my pages, but how can i get them to sit in the middle of the page
| | when
| | > > viewed at 600x800 as well as 1024x768. If i use tables alone, then
i
| | > > assume i just make the table 100% to suit any view, but how to do
this
| | > with
| | > > layers
| | > >
| | > > any help greatly appreciated.
| | > >
| | > > daisy
| | > >
| | > >
| | >
| | >
| |
| |
|
|
 

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