PC Review


Reply
Thread Tools Rate Thread

Centering a layer within a page?

 
 
=?Utf-8?B?bGFybWFu?=
Guest
Posts: n/a
 
      5th Mar 2006
I am building a webpage where I decided to put all text and images within a
layer. I am creating a webpage very similiar to caffezingaro.com. I am pretty
new at this and truly trying to learn code instead of just building from the
split screen. My idea is to isolate the paragraph and pics in the layer and
center everything for ease of reading on all browsers and I have centered the
header and top banner pic. The <p> color is also different then the page
color which again is similiar to the zingaro page. Any help would be greatly
appreciated. I am learning this pretty quickly but my only drawback has been
the whole lining up process. Thanks all.

Larry
 
Reply With Quote
 
 
 
 
Tom
Guest
Posts: n/a
 
      5th Mar 2006
A layer is an Absolute positioned <div> and is based on the 0,0 coordinates
of the nearest
positioned ancestor. This is not what you want/need...

But you can use a relative positioned <div> and CSS to do this.

Change this -

</head>

to this -

<style type="text/css">
<!--
body {
text-align:center;
}
#wrapper {
text-align:left;
width:740px;
margin:0 auto;
position:relative;
}
-->
</style>
</head>

change this -

<body ...>

to this -

<body ...>
<div id="wrapper">

and this -

</body>

to this -

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

That will give you a wrapper / container 740px wide and centered on the page
no matter what the OP's viewport size is.

Tom
"larman" <(E-Mail Removed)> wrote in message
news:F5F07EE0-83CB-4F06-B290-(E-Mail Removed)...
|I am building a webpage where I decided to put all text and images within a
| layer. I am creating a webpage very similiar to caffezingaro.com. I am
pretty
| new at this and truly trying to learn code instead of just building from
the
| split screen. My idea is to isolate the paragraph and pics in the layer
and
| center everything for ease of reading on all browsers and I have centered
the
| header and top banner pic. The <p> color is also different then the page
| color which again is similiar to the zingaro page. Any help would be
greatly
| appreciated. I am learning this pretty quickly but my only drawback has
been
| the whole lining up process. Thanks all.
|
| Larry


 
Reply With Quote
 
=?Utf-8?B?bGFybWFu?=
Guest
Posts: n/a
 
      5th Mar 2006
Two more questions and I will leave all alone for the rest of the day!! How
do I put color to the left and right of the text that I just centered and how
do I spruce up my Nav bar to get rid of the blue text. Tom thank you so
much!! This is such a great resource.

One more. What would you really use layers for other than photos?

"larman" wrote:

> I am building a webpage where I decided to put all text and images within a
> layer. I am creating a webpage very similiar to caffezingaro.com. I am pretty
> new at this and truly trying to learn code instead of just building from the
> split screen. My idea is to isolate the paragraph and pics in the layer and
> center everything for ease of reading on all browsers and I have centered the
> header and top banner pic. The <p> color is also different then the page
> color which again is similiar to the zingaro page. Any help would be greatly
> appreciated. I am learning this pretty quickly but my only drawback has been
> the whole lining up process. Thanks all.
>
> Larry

 
Reply With Quote
 
Tom
Guest
Posts: n/a
 
      5th Mar 2006
The body color is what you will see to the right and left of the
container...

Using the CSS example I gave...

<style type="text/css">
<!--
body {
text-align:center;
background: #2293FF;
}
#wrapper {
text-align:left;
width:740px;
margin:0 auto;
position:relative;
}
-->
</style>

Change the RGB numbers of #2293FF to suit your needs
(If you don't want the center to be that too!)
Then add a background to the container using another RGB color
(Adjusting to your needs).
Like...

<style type="text/css">
<!--
body {
text-align:center;
background: #2293FF;
}
#wrapper {
text-align:left;
width:740px;
margin:0 auto;
position:relative;
background: #2222FF;
}
-->
</style>

Hope this helps some

Tom

"larman" <(E-Mail Removed)> wrote in message
news:8F2D355C-A2DC-4463-928C-(E-Mail Removed)...
| Two more questions and I will leave all alone for the rest of the day!!
How
| do I put color to the left and right of the text that I just centered and
how
| do I spruce up my Nav bar to get rid of the blue text. Tom thank you so
| much!! This is such a great resource.
|
| One more. What would you really use layers for other than photos?
|
| "larman" wrote:
|
| > I am building a webpage where I decided to put all text and images
within a
| > layer. I am creating a webpage very similiar to caffezingaro.com. I am
pretty
| > new at this and truly trying to learn code instead of just building from
the
| > split screen. My idea is to isolate the paragraph and pics in the layer
and
| > center everything for ease of reading on all browsers and I have
centered the
| > header and top banner pic. The <p> color is also different then the page
| > color which again is similiar to the zingaro page. Any help would be
greatly
| > appreciated. I am learning this pretty quickly but my only drawback has
been
| > the whole lining up process. Thanks all.
| >
| > Larry


 
Reply With Quote
 
Tom
Guest
Posts: n/a
 
      5th Mar 2006
Forgot about the Layers...

We will start with "Layers are BAD"
and then move on to an explanation of layers so you will better understand.
============================
Layers are bad.

Layers are bad because they are absolutely positioned. As such, they have
several "undesirable" characteristics (particularly for those who do not
understand HTML and CSS/positioning):

1. A layer floats over (in the z-direction, i.e., vertically out of the
page) other page content. Thus it can mask mouse events on that other page
content - this is what is responsible for problem with the non-functional
link underneath one.

2. Because a layer floats over other page content, it cannot interact with
that other page content - thus when the text content in a layer is resized
in the browser, causing the layer to expand vertically, the text will start
to overlap the other page content, leading to an unusable mess in the
browser.

3. Because a layer is absolutely positioned, it stays fixed on the screen
while other content which may be within a percent sized container is free to
move around. Unless you are familiar enough with CSS to know how to
accommodate this flexibility, you will probably post a question here called
"Why are my layers moving?". Then everyone can post replies telling you that
layers don't move....

4. Because a layer is absolutely positioned, if it is contained within a
flexible container, if the container flexes, the layer will flex with it,
perhaps causing images within that layer to overlap other underlying page
content.

Layers are very seductive because they are easy to place on the page.
This ease of placement extracts a VERY heavy price in terms of page
usability and functionality. It's best to not use them at all until you
understand enough HTML and CSS to manage the page without layers. Most
experienced developers
use absolute positioned elements quite sparingly if at all..

==========================
Layers

This may help you understand positioning a bit -

There are 4 different types of positioning:
Absolute
Relative
Fixed
Static

Here is a brief explanation of each kind of positioning (with regard to
placement of elements on the page only)....

Position:absolute (or A/P elements)
-----------------------
This does several things -
1. It 'removes' the element from the flow of the code on the* page so that
it can no longer influence the size or position of any other pa-ge element
(except for those contained within it, of course).

2. The absolutely positioned element takes its position from the position of
its closest PA*RENT *positioned* element - in the absence of any explicitly
positioned parent, this will default to the <body> tag, which is always
positioned *at 0,0 in the browser viewport.

This means that it doesn't matter where in the HTML code the laye*r's code
appears (between <body> and </body>), its location on the screen will not
change (this assumes that you have not positioned the A/P element within a
table or another A/P element, of course). Furthe*rmore, the space in
which this element would have appeared were it not positi*oned is not
preserved on the screen. In other words, absolutely positioned elements
don't take up any space on the page. In fact, they FLOAT over the page.

Position:relative (or R/P elements)
----------------------
In contrast to absolute positioning, a relatively positioned page element is
*not* removed from t*he flow of the code on the page, so it will use the
spot where it would have* appeared based on its position in the code as its
zero point reference. If* you then supply top, right, bottom, or left
positions
to the style for this *element, those values will be used as offsets from
its zero point.

This means that it DOES matter where in the code the relativ*ely positioned
element appears (, as it will be positioned in that location (*factoring in
the offsets) on the screen (this is true for any placement in the code).
Furthermore, the space where this e*lement would have appeared is preserved
in the display, and can therefore* affect the placement of succeeding
elements. This means that the taller a relatively
positioned element is, the more space it forces on the page.

Position:static
-------------------
As with relative position, static positions also "go with *the flow". An
element with a static position cannot have values for offset*s (top, right,
left, bottom) or if it has them, they will be ignored. Unless explicitly
positioned, all div elements default to static positioning.

Position:fixed
------------------
A page element with this style will not scroll as the page c*ontent scrolls.
Support for this in elements other than page backgrounds is *quirky

There are several other things you need to know:

1. ANY page element can be positioned - paragraphs, tables, images, lists,
etc.
2. The <div> tag is a BLOCK level tag. This means that if it is not
positioned or explicitly styled otherwise,
a) it will always begin on a new line on the screen, and
b) it will always force content to a new line below it, and
c) it will always take up the entire width of its container (i.e.,
width:100%).
3. The placement of A/P elements *can* affect the BEHAVIOR of other elements
on the page. For example, a 'layer' placed over a hyperlink will mask that
hyperlink.

===============================

Tom
"Tom" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
| The body color is what you will see to the right and left of the
| container...
|
| Using the CSS example I gave...
|
| <style type="text/css">
| <!--
| body {
| text-align:center;
| background: #2293FF;
| }
| #wrapper {
| text-align:left;
| width:740px;
| margin:0 auto;
| position:relative;
| }
| -->
| </style>
|
| Change the RGB numbers of #2293FF to suit your needs
| (If you don't want the center to be that too!)
| Then add a background to the container using another RGB color
| (Adjusting to your needs).
| Like...
|
| <style type="text/css">
| <!--
| body {
| text-align:center;
| background: #2293FF;
| }
| #wrapper {
| text-align:left;
| width:740px;
| margin:0 auto;
| position:relative;
| background: #2222FF;
| }
| -->
| </style>
|
| Hope this helps some
|
| Tom
|
| "larman" <(E-Mail Removed)> wrote in message
| news:8F2D355C-A2DC-4463-928C-(E-Mail Removed)...
|| Two more questions and I will leave all alone for the rest of the day!!
| How
|| do I put color to the left and right of the text that I just centered and
| how
|| do I spruce up my Nav bar to get rid of the blue text. Tom thank you so
|| much!! This is such a great resource.
||
|| One more. What would you really use layers for other than photos?
||
|| "larman" wrote:
||
|| > I am building a webpage where I decided to put all text and images
| within a
|| > layer. I am creating a webpage very similiar to caffezingaro.com. I am
| pretty
|| > new at this and truly trying to learn code instead of just building
from
| the
|| > split screen. My idea is to isolate the paragraph and pics in the layer
| and
|| > center everything for ease of reading on all browsers and I have
| centered the
|| > header and top banner pic. The <p> color is also different then the
page
|| > color which again is similiar to the zingaro page. Any help would be
| greatly
|| > appreciated. I am learning this pretty quickly but my only drawback has
| been
|| > the whole lining up process. Thanks all.
|| >
|| > Larry
|
|


 
Reply With Quote
 
=?Utf-8?B?bGFybWFu?=
Guest
Posts: n/a
 
      6th Mar 2006
Tom,

Thank you so much for all your help. Two more questions and I will leave you
alone. How would I change nav colors as far as the blue default on nav text.
I actually built it as follows:

<div id="navigation">
<div align="center">
<span class="style1"><a href="index.htm">|Home</a>|
<a href="baristas.htm">Baristas|</a>|
<a href="coffee.htm">Coffee</a>|
<a href="desserts.htm">Desserts</a>|
<a href="art.htm">Art</a>|
<a href="music.htm">Music</a>|
<a href="contacts.htm">Contact</a>|</span></div>
</div>

AND how do I bring the center all the way up to the top and bottom of the
webpage.

Thanks again and have a great rest of the weekend.



"Tom" wrote:

> A layer is an Absolute positioned <div> and is based on the 0,0 coordinates
> of the nearest
> positioned ancestor. This is not what you want/need...
>
> But you can use a relative positioned <div> and CSS to do this.
>
> Change this -
>
> </head>
>
> to this -
>
> <style type="text/css">
> <!--
> body {
> text-align:center;
> }
> #wrapper {
> text-align:left;
> width:740px;
> margin:0 auto;
> position:relative;
> }
> -->
> </style>
> </head>
>
> change this -
>
> <body ...>
>
> to this -
>
> <body ...>
> <div id="wrapper">
>
> and this -
>
> </body>
>
> to this -
>
> </div><!-- /wrapper -->
> </body>
>
> That will give you a wrapper / container 740px wide and centered on the page
> no matter what the OP's viewport size is.
>
> Tom
> "larman" <(E-Mail Removed)> wrote in message
> news:F5F07EE0-83CB-4F06-B290-(E-Mail Removed)...
> |I am building a webpage where I decided to put all text and images within a
> | layer. I am creating a webpage very similiar to caffezingaro.com. I am
> pretty
> | new at this and truly trying to learn code instead of just building from
> the
> | split screen. My idea is to isolate the paragraph and pics in the layer
> and
> | center everything for ease of reading on all browsers and I have centered
> the
> | header and top banner pic. The <p> color is also different then the page
> | color which again is similiar to the zingaro page. Any help would be
> greatly
> | appreciated. I am learning this pretty quickly but my only drawback has
> been
> | the whole lining up process. Thanks all.
> |
> | Larry
>
>
>

 
Reply With Quote
 
Tom
Guest
Posts: n/a
 
      6th Mar 2006
Blue text in nav bar? Not sure exactly BUT
Try a bit more CSS to color the links the way you want.
Added more........
<style type="text/css">
<!--
body {
text-align:center;
background: #2293FF;
}
#wrapper {
text-align:left;
width:740px;
margin:0 auto;
position:relative;
color: #2222FF;
}
a {
text-decoration: none;
border: none;
font: medium "Times New Roman", Times, serif;
color: #000000;
background-color: transparent;
}
a:link {
text-decoration: none;
}
a:visited {
color: #000088;
}

a:hover {
color: #FF0000;
}
-->
</style>

This is black text then on hover Red. Then visited dark blue...
Change the RGB color code to make them what you want...

HTH

Tom

"larman" <(E-Mail Removed)> wrote in message
news:8F2D355C-A2DC-4463-928C-(E-Mail Removed)...
| Two more questions and I will leave all alone for the rest of the day!!
How
| do I put color to the left and right of the text that I just centered and
how
| do I spruce up my Nav bar to get rid of the blue text. Tom thank you so
| much!! This is such a great resource.
|
| One more. What would you really use layers for other than photos?
|
| "larman" wrote:
|
| > I am building a webpage where I decided to put all text and images
within a
| > layer. I am creating a webpage very similiar to caffezingaro.com. I am
pretty
| > new at this and truly trying to learn code instead of just building from
the
| > split screen. My idea is to isolate the paragraph and pics in the layer
and
| > center everything for ease of reading on all browsers and I have
centered the
| > header and top banner pic. The <p> color is also different then the page
| > color which again is similiar to the zingaro page. Any help would be
greatly
| > appreciated. I am learning this pretty quickly but my only drawback has
been
| > the whole lining up process. Thanks all.
| >
| > Larry


 
Reply With Quote
 
Tom
Guest
Posts: n/a
 
      6th Mar 2006
The last post I messed up the wrapper color... SO

This will take it to the top of the page too...

<style type="text/css">
<!--
body {
text-align:center;
background: #2293FF;
margin: 0;
}
#wrapper {
text-align:left;
width:740px;
margin:0 auto;
position:relative;
background-color: #2222FF;
}
a {
text-decoration: none;
border: none;
color: #000000;
background-color: transparent;
}
a:link {
text-decoration: none;
}
a:visited {
color: #000088;
}

a:hover {
color: #FF0000;
}
-->
</style>

Have a nice day....

Tom

"larman" <(E-Mail Removed)> wrote in message
news:694675A9-7436-42C9-95F1-(E-Mail Removed)...
| Tom,
|
| Thank you so much for all your help. Two more questions and I will leave
you
| alone. How would I change nav colors as far as the blue default on nav
text.
| I actually built it as follows:
|
| <div id="navigation">
| <div align="center">
| <span class="style1"><a href="index.htm">|Home</a>|
| <a href="baristas.htm">Baristas|</a>|
| <a href="coffee.htm">Coffee</a>|
| <a href="desserts.htm">Desserts</a>|
| <a href="art.htm">Art</a>|
| <a href="music.htm">Music</a>|
| <a href="contacts.htm">Contact</a>|</span></div>
| </div>
|
| AND how do I bring the center all the way up to the top and bottom of the
| webpage.
|
| Thanks again and have a great rest of the weekend.
|
|
|
| "Tom" wrote:
|
| > A layer is an Absolute positioned <div> and is based on the 0,0
coordinates
| > of the nearest
| > positioned ancestor. This is not what you want/need...
| >
| > But you can use a relative positioned <div> and CSS to do this.
| >
| > Change this -
| >
| > </head>
| >
| > to this -
| >
| > <style type="text/css">
| > <!--
| > body {
| > text-align:center;
| > }
| > #wrapper {
| > text-align:left;
| > width:740px;
| > margin:0 auto;
| > position:relative;
| > }
| > -->
| > </style>
| > </head>
| >
| > change this -
| >
| > <body ...>
| >
| > to this -
| >
| > <body ...>
| > <div id="wrapper">
| >
| > and this -
| >
| > </body>
| >
| > to this -
| >
| > </div><!-- /wrapper -->
| > </body>
| >
| > That will give you a wrapper / container 740px wide and centered on the
page
| > no matter what the OP's viewport size is.
| >
| > Tom
| > "larman" <(E-Mail Removed)> wrote in message
| > news:F5F07EE0-83CB-4F06-B290-(E-Mail Removed)...
| > |I am building a webpage where I decided to put all text and images
within a
| > | layer. I am creating a webpage very similiar to caffezingaro.com. I am
| > pretty
| > | new at this and truly trying to learn code instead of just building
from
| > the
| > | split screen. My idea is to isolate the paragraph and pics in the
layer
| > and
| > | center everything for ease of reading on all browsers and I have
centered
| > the
| > | header and top banner pic. The <p> color is also different then the
page
| > | color which again is similiar to the zingaro page. Any help would be
| > greatly
| > | appreciated. I am learning this pretty quickly but my only drawback
has
| > been
| > | the whole lining up process. Thanks all.
| > |
| > | Larry
| >
| >
| >


 
Reply With Quote
 
Viken Karaguesian
Guest
Posts: n/a
 
      6th Mar 2006
Tom,

I don't understand this code :>( If you could expand on this a bit, I
would appreciate it. Some points of interest for me:

1) Why position:relative? Wouldn't it be enough to just set the width and
right/left margin to auto?

2) Why is this code (below) placed inside a comment? Are you trying to hide
it from another browser?
> <style type="text/css">
> <!--
> body {
> text-align:center;
> }
> #wrapper {
> text-align:left;
> width:740px;
> margin:0 auto;
> position:relative;
> }
> -->
> </style>


3) Same question about this code:

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


I'm no expert, but I have a more-than-basic understanding of CSS and HTML. I
can't quite figure out the purpose behind this code. If you could explain
the concept behind this code, I'd appreciate it. The more I learn, the
happier I am :>)

--
Viken K.
http://www.vikenk.com


 
Reply With Quote
 
Tom
Guest
Posts: n/a
 
      6th Mar 2006
Looking at it more closely....
You might want to add a space before the closeting </a> tag to make it more
even.
like

<div id="navigation">
<div align="center">
<span class="style1"><a href="index.htm">| Home </a>|
<a href="baristas.htm">Baristas </a>|
<a href="coffee.htm">Coffee </a>|
<a href="desserts.htm">Desserts </a>|
<a href="art.htm">Art </a>|
<a href="music.htm">Music </a>|
<a href="contacts.htm">Contact </a>|</span></div>
</div>

ave a good night

Tom
"Tom" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
| The last post I messed up the wrapper color... SO
|
| This will take it to the top of the page too...
|
| <style type="text/css">
| <!--
| body {
| text-align:center;
| background: #2293FF;
| margin: 0;
| }
| #wrapper {
| text-align:left;
| width:740px;
| margin:0 auto;
| position:relative;
| background-color: #2222FF;
| }
| a {
| text-decoration: none;
| border: none;
| color: #000000;
| background-color: transparent;
| }
| a:link {
| text-decoration: none;
| }
| a:visited {
| color: #000088;
| }
|
| a:hover {
| color: #FF0000;
| }
| -->
| </style>
|
| Have a nice day....
|
| Tom
|
| "larman" <(E-Mail Removed)> wrote in message
| news:694675A9-7436-42C9-95F1-(E-Mail Removed)...
|| Tom,
||
|| Thank you so much for all your help. Two more questions and I will leave
| you
|| alone. How would I change nav colors as far as the blue default on nav
| text.
|| I actually built it as follows:
||
|| <div id="navigation">
|| <div align="center">
|| <span class="style1"><a href="index.htm">|Home</a>|
|| <a href="baristas.htm">Baristas|</a>|
|| <a href="coffee.htm">Coffee</a>|
|| <a href="desserts.htm">Desserts</a>|
|| <a href="art.htm">Art</a>|
|| <a href="music.htm">Music</a>|
|| <a href="contacts.htm">Contact</a>|</span></div>
|| </div>
||
|| AND how do I bring the center all the way up to the top and bottom of the
|| webpage.
||
|| Thanks again and have a great rest of the weekend.
||
||
||
|| "Tom" wrote:
||
|| > A layer is an Absolute positioned <div> and is based on the 0,0
| coordinates
|| > of the nearest
|| > positioned ancestor. This is not what you want/need...
|| >
|| > But you can use a relative positioned <div> and CSS to do this.
|| >
|| > Change this -
|| >
|| > </head>
|| >
|| > to this -
|| >
|| > <style type="text/css">
|| > <!--
|| > body {
|| > text-align:center;
|| > }
|| > #wrapper {
|| > text-align:left;
|| > width:740px;
|| > margin:0 auto;
|| > position:relative;
|| > }
|| > -->
|| > </style>
|| > </head>
|| >
|| > change this -
|| >
|| > <body ...>
|| >
|| > to this -
|| >
|| > <body ...>
|| > <div id="wrapper">
|| >
|| > and this -
|| >
|| > </body>
|| >
|| > to this -
|| >
|| > </div><!-- /wrapper -->
|| > </body>
|| >
|| > That will give you a wrapper / container 740px wide and centered on the
| page
|| > no matter what the OP's viewport size is.
|| >
|| > Tom
|| > "larman" <(E-Mail Removed)> wrote in message
|| > news:F5F07EE0-83CB-4F06-B290-(E-Mail Removed)...
|| > |I am building a webpage where I decided to put all text and images
| within a
|| > | layer. I am creating a webpage very similiar to caffezingaro.com. I
am
|| > pretty
|| > | new at this and truly trying to learn code instead of just building
| from
|| > the
|| > | split screen. My idea is to isolate the paragraph and pics in the
| layer
|| > and
|| > | center everything for ease of reading on all browsers and I have
| centered
|| > the
|| > | header and top banner pic. The <p> color is also different then the
| page
|| > | color which again is similiar to the zingaro page. Any help would be
|| > greatly
|| > | appreciated. I am learning this pretty quickly but my only drawback
| has
|| > been
|| > | the whole lining up process. Thanks all.
|| > |
|| > | Larry
|| >
|| >
|| >
|
|


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
business layer, data access layer , presentation layer for asp.net using C#.net Dhananjay Microsoft VB .NET 6 20th Dec 2006 02:16 AM
business layer, data access layer , presentation layer for asp.net using C#.net Dhananjay Microsoft C# .NET 2 19th Dec 2006 09:23 AM
business layer, data access layer , presentation layer for asp.net using C#.net Dhananjay Microsoft ASP .NET 1 18th Dec 2006 11:35 PM
Centering a layer w/image behind table =?Utf-8?B?c3RldmVyaW5v?= Microsoft Frontpage 7 27th Nov 2006 08:54 AM
Page Centering Tru Dixon Microsoft Frontpage 0 7th Jul 2003 05:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:13 PM.