Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / August 2004



Tip: Looking for answers? Try searching our database.

Problem with layouting without tables

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Juergen Lang - 30 Aug 2004 15:49 GMT
Hello!

I want to style a layout without the use of tables.
Instead of tables, I would like to use styled div-tags.

The Layout is (or better: should be) as follows:

+--------------------------------+
| BG 1 | Content          | BG 3 |
+------+                  +------+
       |                  |
       |                  |
       |                  |
       |                  |
       |                  |
       ~~~~~~~~~~~~~~~~~~~~

BG 1 and BG 2 are different images. The "Content" area has a width of
850px and should be centered! Left and right space from the "Content"
area should be filled with those two background images.

This was my first attempt:

Style:
-----------------------------------------------------------------------

div#main-lft {
    postion: relative;
    background: url('images/bg_lft.jpg');
    background-repeat: repeat-x;
    height: 78px;
    float: left;
}

div#main-mid {
    width: 851px;
    postion: relative;
    margin: 0px auto auto auto;
    border-right: 1px solid white;
    border-bottom: 1px solid white;
    border-left: 1px solid white;
    float: left;
}

div#main-rgt {
    postion: relative;
    background: url('images/bg_rgt.jpg');
    background-repeat: repeat-x;
    height: 78px;
    float: left;
}

HTML:
-----------------------------------------------------------------------

<div id="main">

    <div id="main-lft">&nbsp;</div>

    <div id="main-mid">Content</div>

    <div id="main-rgt">&nbsp;</div>

</div>

The items are now positioned like they should be, but the "Content" area
is not centered and the background areas do not fill the rest of the
screen?!

Now, does anybody have an idea of how to solve this layout problem?

Thank you very much in advance,
Juergen

Signature

Juergen Lang      <getinspired@despammed.com>      http://getinspired.at

xtort - 31 Aug 2004 06:54 GMT
Maybe assigning
width: auto;
to the content DIV might make it center--or negative margins?

best,
xtort

> Hello!
>
[quoted text clipped - 69 lines]
> Thank you very much in advance,
> Juergen
Juergen Lang - 31 Aug 2004 09:56 GMT
Hello!

> Maybe assigning
> width: auto;
> to the content DIV might make it center--or negative margins?

Funnily, assigning a width of 'auto' does not solve the problem.
The browser makes 'auto' to the full width of the current window, so
that the next <div> tag begins in the next row. :\

Thank you,
Juergen Lang

Signature

Juergen Lang      <getinspired@despammed.com>      http://getinspired.at

Els - 31 Aug 2004 08:29 GMT
> Hello!
>
[quoted text clipped - 19 lines]
>
> This was my first attempt:

[snip code]

>      postion: relative;
>      postion: relative;
>      postion: relative;

Besides not needing position:relative, it wouldn't work with
the missing i in the word...

As the left and right 'area' are only to hold pictures, I
suppose you need this:

html:
<div id="container">
 <div id="left"></div>
 <div id="main"></div>
 <div id="right"></div>
</div>

Assuming each picture is 50px wide:

CSS:
body{text-align:center;}
#container{width:950px;margin:0px auto;text-align:left;}
#left{width:50px;}
#main{width:850px;}
#main{width:50px;}

> The items are now positioned like they should be, but the
> "Content" area is not centered and the background areas do
> not fill the rest of the screen?!

Ah, so the pictures on the left and right should be larger
when the window is larger and smaller if the window is
smaller...

Okay:

HTML:

<div id="container">
<div id="inner">
 <div id="main"></div>
</div>
</div>

CSS:

#container{
background-image:url(leftimage.jpg);
background-position:top left;
background-repeat:no-repeat; /*or repeat-y*/
}
#inner{
background-image:url(rightimage.jpg);
background-position:top right;
background-repeat:no-repeat; /*or repeat-y*/
text-align:center;
}
#main{
width:850px;
margin:0 auto;
text-align:left;
}

NOT tested!

> Now, does anybody have an idea of how to solve this layout
> problem?
>
> Thank you very much in advance,
> Juergen


Signature

Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
                            - Renato Russo -

Juergen Lang - 31 Aug 2004 09:54 GMT
Hello!

> Ah, so the pictures on the left and right should be larger
> when the window is larger and smaller if the window is
> smaller...

That's right ...

> Okay:
>
[quoted text clipped - 26 lines]
>
> NOT tested!

Very good idea!
The only problem with this is, that the rightimage.jpg lays over the
leftimage.jpg along the whole width of the screen, because I have to use
repeat-x (BG-tile).

Now my *working* solution (based on yours) is as follows:

CSS:

#container{
    background-image: url('images/bg_rgt.jpg');
    background-position: top right;
    background-repeat: repeat-x;
}
#inner{
    background-image: url('images/bg_lft.jpg');
    background-position: top left;
    background-repeat: no-repeat;

}
#main{
    width: 851px;
    margin: 0px auto auto auto;
    border-left: 1px solid white;
    border-right: 1px solid white;
    border-bottom: 1px solid white;
    height: 78px;
}

HTML:

<div id="container">

    <div id="inner">

        <div id="main">test</div>

    </div>

</div>

'bg_lft.jpg' now has a fixed width of 550px, so that (even on very high
screen resolutions) it overlays images/bg_rgt.jpg for the width of 525px
and then 'images/bg_rgt.jpg' begins. Both are overlayed with the 'main'
area!

Not the finest way, but ... a working way.

Thank you very much!

Signature

Juergen Lang      <getinspired@despammed.com>      http://getinspired.at

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.