We’d like to remind Forumites to please avoid political debate on the Forum.

This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.

📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

Calling all CSS experts

Hi.

I'm not a web designer but I'm starting to make my own website and have just got a slight problem with the layout using DIV's that I need your help with. I've searched and searched but not found an answer.

Have a look at my test site here I want the Main Content DIV to auto expand to match the height of the left menu DIV. With tables this would be easy. I have also seen examples that mix tables and CSS to achieve what I want but I want to use pure CSS

Ta :)

Comments

  • create a "footer" div.

    Then give it the propertys of :-

    clear: both;

    then insert it onto your page under the menu and content divs.
  • wolfman
    wolfman Posts: 3,225 Forumite
    Yeah that's what I've done.

    I basically created a "cleaner" div, and put it after both my main content and left navigation div tags. Then just applied the following style to it:

    .Cleaner
    !!
    background-color: Transparent;
    clear: both;
    height: 0px;
    font-size: 1px;
    margin: 0px;
    padding: 0px;
    }

    It should work in all recent browsers.
    "Boonowa tweepi, ha, ha."
  • moneyuser
    moneyuser Posts: 1,085 Forumite
    Part of the Furniture 1,000 Posts Combo Breaker
    Thanks for the replies but extra div using clear: both doesn't work. I believe that is used so non-IE browser can wrap the container box around the left menu and content areas. In my case I'm using the clearfix class to achieve the same results.

    I've added a screenshot on the site so you can see what I want to do. Notice how the colour and border now match the left menu.

    :)
  • wolfman
    wolfman Posts: 3,225 Forumite
    Ah ok. I'll check what I've done when I get home. You basically want to stretch the content div, or navigation div so they both reach the bottom of the container div.

    Could have sworn the above method will do that. I used to have a similar design, I'll check when I get back.
    "Boonowa tweepi, ha, ha."
  • martindow
    martindow Posts: 10,602 Forumite
    Part of the Furniture 10,000 Posts Name Dropper
    I'm no expert on this but I think that this can be dealt with using faux columns
    http://www.alistapart.com/articles/fauxcolumns/

    http://css-discuss.incutio.com/ is also a good resource for css positioning. Good luck.
  • moneyuser
    moneyuser Posts: 1,085 Forumite
    Part of the Furniture 1,000 Posts Combo Breaker
    faux columns looks interesting but I'm not sure if it would work with what I intend to do with the site but thanks anyway.
  • moneyuser
    moneyuser Posts: 1,085 Forumite
    Part of the Furniture 1,000 Posts Combo Breaker
    Ok, bit more searching and I found a rather nifty java script over at Killersites that does exactly what I want.

    Just posting this in case someone has the same problem ;)
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 351.7K Banking & Borrowing
  • 253.4K Reduce Debt & Boost Income
  • 454K Spending & Discounts
  • 244.7K Work, Benefits & Business
  • 600.1K Mortgages, Homes & Bills
  • 177.3K Life & Family
  • 258.4K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.2K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.