Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Layers

Status
Not open for further replies.

leonsf

Programmer
Apr 14, 2005
2
US
I've got a question about layers. I have set up a page using a layout grid, which I have center aligned in order that the content will always appear in the middle of the screen when somebody resizes their browser.
When I add a layer, the layer always remains in the same place when I resize the browser.
Is there a way to get the layer to align with the rest of the page, especially when I would like the rest of the content to be center aligned?
 
Were you able to solve this issue - I have a similar need to center the upper layer but can find no way to accomplish it. I guess we could use left align pages but that would change the structure of my site.
 
HTML isn't capable of centering a layer that way. You need to use CSS.

For example, if your layed has an id of "container" you would center it with this CSS rule:

#container { margin: 0 auto 0 auto; }

CSS doesn't have simple keywords like center to position items. It's much more flexible, but also more complicated, then html.

In the above CSS rule you see "margin: 0 auto 0 auto;". This sets the positioning. The four margin values are order top, right, bottom, and left. By setting the right and left values to 'auto' the layer is centered.

I can't give you the specific css rule to center your layer since you didn't post your page, and now i'm leaving for a weeks vacation away from computers and general life, but hopefully the above explaination is enough to help you solve your problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top