This is a discussion on "How to create a centered page with layers." within the Web Page Design section. This forum, and the thread "How to create a centered page with layers. are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
How to create a centered page with layers.
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
How to create a centered page with layers.
I am trying to shake my addiction for tables and plunged in with CSS and layers but I'm sinking fast... The idea was to lay everything in a master layer1 box that would be centered in any browser and resolution.
Last edited by saltedm8; Mar 10th, 2008 at 20:59. Reason: added [code][/code] tags |
|
|
|
||||
|
Re: How to create a centered page with layers.
i can only guess you are using dreamweaver in layer mode, in this case, code like this
but if you want to use that code, you can use floating divs and margin etc this is not the best tutorial i have seen, but it might give you an idea into them http://www.alistapart.com/articles/practicalcss/
Last Blog Entry: Basic Advice for newbies (Feb 1st, 2008)
Last edited by saltedm8; Mar 10th, 2008 at 22:39. |
|
|||
|
Re: How to create a centered page with layers.
Dreamweaver all right but for the moment not dreamy for me, but thanks for having a look. I have been on this for a while. I can create layers of color block to center with Layer1 in different browser. But when I fill them with text we are back to the left.
This info is what I get on several sites; "If you want other elements to be absolutely positioned inside Layer1, make it relatively positioned first". #wrapper {position: relative; width: 760px; margin: 0 auto; text-align: left; } This as the rest lays fine in 1024x768 but not if we go to higher res. Just no go for me. I thought that once you centered the first layer anything in it would hold its own with in it? SG Brix |
|
||||
|
Re: How to create a centered page with layers.
this is an example on how you could create a wrapper, then put divs inside that wrapper
notice that the </div> to the wrapper is at the bottom and there are divs within that - that are closed, the rest i think you have enougth knowledge to work out it does not work for absolutes hope this helps
Last Blog Entry: Basic Advice for newbies (Feb 1st, 2008)
Last edited by saltedm8; Mar 10th, 2008 at 22:36. |
|
|||
|
Re: How to create a centered page with layers.
I added new layers to your sample, they all shoot to the left when using a higher resolution. The idea is for the page with layers to keep in the center for any resolution. Like centering a table and place layers inside, which as Izzard would say, "is not a good idea".
#content {float:left; width: 250px; margin: 0 auto; text-align: left; } #Layer1 { position:absolute; left:278px; top:50px; width:151px; height:100px; z-index:1; background-color: #CC0000; } and so on |
|
||||
|
Re: How to create a centered page with layers.
If all you are trying to do is center your layout then have everything inside it its pretty straight forward. (It would help if you had something online we could see).
#container { width:770px margin:0 auto; } #leftColumn { width:200px; float:left; } #rightColumn { margin:0 0 0 205px; } <div id="container"> <div id="leftColumn"> <ul> <li><a href="">Link Here</a></li> <li><a href="">Link Here</a></li> <li><a href="">Link Here</a></li> <li><a href="">Link Here</a></li> <li><a href="">Link Here</a></li> </ul> </div> <!-- end #leftColumn --> <div id="rightColumn"> <p>Sample text paragraph</p> </div> <!-- end #rightColumn --> </div> <!-- end #container -->
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
|
|||
|
Re: How to create a centered page with layers.
Thanks moojoo for your input. Yes the idea is for the page to be centered in any resolution/browser. I tried using the script you supplied but got nowhere with it, mainly because I'm not good working with code directly. I am trying to learn. In my first posting is the complete page script with some comments of mine that should not have been in there. There is to be another column on the right hand side, but I stopped when I realize nothing besides Layer1 was centered.
SG Brix |
|
||||
|
Re: How to create a centered page with layers.
I think part of the problem is you are confusing the term "layers". Layers is just DW's way of saying "DIV" and they are not actually layers. When you start absolute positioning etc you are taking objects out of the normal flow. Now if say your masthead was absolutely positioned with a left:auto and contained in a centered container it should stay centered. My suggestion is to scrap what you have, start from scratch and take it one step at a time. You can then add elements in steps and immediately trouble shoot any issues you have.
The above mentioned method would be used if say you had your header content at the bottom of your HTML code to keep it from getting indexed first by spiders. The bare bones required to center your layout is to 1. Define a width for your container 2. margin:0 auto; However this may get wonky in IE 5.x and even IE 7 so you can text-align:center; on the body {} in your CSS then text-align:left on your container div. Try to think of it as simple boxes and not elements stacked on each other. Once your layout is centered you can put as many columns as you need to within the container. http://mevans76.com/css_layouts/ has various functional examples in both fixed and fluid formats and from 1 to 3 columns. Feel free to use them for reference and a starting point.
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Last edited by moojoo; Mar 11th, 2008 at 15:41. |
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Which software to use to create a web page? | learner6 | Starting Out | 8 | Mar 31st, 2008 17:56 |
| Page does not stay vertically centered in IE using CSS | needhelppls | Web Page Design | 10 | Jan 28th, 2008 23:56 |
| centreing a whole page with layers | Gerry | Web Page Design | 5 | Sep 4th, 2007 15:25 |
| Layers that go the entire Height of the page. | briandina | Web Page Design | 0 | Dec 31st, 2006 21:01 |
| Centering layers in a page | gwx03 | Web Page Design | 9 | Nov 26th, 2003 19:55 |