views:

35

answers:

1

Hello,

I am sure this is a common frustration - but I am trying to just do a two column liquid with a footer in rails.

The problem that I am having is that I can get the footer to stick on the bottom, or to the columns. I am using this for my basis for the columns, I just need them to stretch to the bottom of the page, filling with color!!

The layout for the frame:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    <title>Shows: <%= controller.action_name %> </title>
    <%=  stylesheet_link_tag 'frame', 'show' %>
  </head>
  <body>
    <div id="header">
    </div>

    <div class="colmask ">
      <div class="colleft">

        <div class="main"> <!-- The Main window -->
          <% if flash[:notice] -%>
            <div id="flash"><%= flash[:notice] %> </div>
          <% end -%>
          <%= yield %>
        </div>

        <div class="side"> <!-- The Sidebar -->
          <%= link_to "Home", :controller => :shows, :action => :index %><br/>
          <br/>
          Shows<br/>
          <% Show.all.each do |sh| %>
            <div class="side_title">
              <%= link_to sh.title, show_url(sh) %><br/>
            </div>
          <% end %>
        </div>
      <div id="push"></div>
      </div>
    </div>
    <div id="footer"> <!-- Put a footer in this panel -->
      This is where some more information can go...
    </div>
  </body>
</html>

The CSS - probably full of problems...help!?:

/*
   Template for layout from
    http://matthewjamestaylor.com/blog/perfect-2-column-left-menu.htm
   Thanks!
*/

html {
  height: 100%;
}

body {
  margin:0;
  padding:0;
  border:0;         /* This removes the border around the viewport in old versions of IE */
  width:100%;
  background:#fff;
  min-width:600px;      /* Minimum width of layout - remove line if not required */
                        /* The min-width property does not work in old versions of Internet Explorer */
  font-size:90%;
  height: 100%;
}
a {
  color:#369;
}
a:hover {
  color:#fff;
  background:#369;
  text-decoration:none;
}
h1, h2, h3 {
  margin:.8em 0 .2em 0;
  padding:0;
}
p {
  margin:.4em 0 .8em 0;
  padding:0;
}
img {
  margin:10px 0 5px;
}

/* Header styles */
#header {
  clear:both;
  float:left;
  width:100%;
}
#header {
  border-bottom:1px solid #000;
}
#header p,
#header h1,
#header h2 {
  padding:.4em 15px 0 15px;
  margin:0;
}
#header ul {
  clear:left;
  float:left;
  width:100%;
  list-style:none;
  margin:10px 0 0 0;
  padding:0;
}
#header ul li {
  display:inline;
  list-style:none;
  margin:0;
  padding:0;
}
#header ul li a {
  display:block;
  float:left;
  margin:0 0 0 1px;
  padding:3px 10px;
  text-align:center;
  background:#eee;
  color:#000;
  text-decoration:none;
  position:relative;
  left:15px;
  line-height:1.3em;
}
#header ul li a:hover {
  background:#369;
  color:#fff;
}
#header ul li a.active,
#header ul li a.active:hover {
  color:#fff;
  background:#000;
  font-weight:bold;
}
#header ul li a span {
  display:block;
}

/* 'widths' sub menu */
#layoutdims {
  clear:both;
  background:#eee;
  border-top:4px solid #000;
  margin:0;
  padding:6px 15px !important;
  text-align:right;
}

/* column container */
.colmask {
  position:relative;    /* This fixes the IE7 overflow hidden bug */
  clear:both;
  float:left;
  width:100%;           /* width of whole page */
  overflow:hidden;      /* This chops off any overhanging divs */

}
/* common column settings */
.colleft {
  float:left;
  width:100%;
  position:relative;

  min-height: 100%;
  height: auto;
  height: 100%;
  margin: 0 auto -60px;
}

.main,
.side {
  float:left;
  position:relative;
  padding:0 0 1em 0;
  overflow:hidden;
}

/* 2 Column (left menu) settings */
.colmask {
  background:orange;            /* right column background colour */
}
.colmask .colleft {
  right:75%;            /* right column width */
  background:green;     /* left column background colour */
}
.colmask .main {
  width:71%;            /* right column content width */
  left:102%;                    /* 100% plus left column left padding */
}
.colmask .side {
  width:21%;            /* left column content width (column width minus left and right padding) */
  left:6%;          /* (right column left and right padding) plus (left column left padding) */
}

#push, #footer {
  height: 60px;
  clear: both;
}

/* Footer styles */
#footer {
  position:relative;
  bottom:0;
  float:left;
  width:100%;
  border-top:1px solid #000;
}
#footer p {
  padding:10px;
  margin:0;
}
A: 

Easiest solution would be, to just add a background image to your wrapper

#left_col, #right_col {
  display: inline;
  float: left;
  margin: 0 10px;
  width: 400px;
}

<div id="wrapper">
  <div id="left_col">
    <!--left_col content-->
  </div><!--/left_col-->

  <div id="right_col">
    <!--right_col content-->
  </div><!--/right_col-->
<div style="clear: both"/>
</div><!--/wrapper->

If your code looks like this, just add a y-axis repeating background image to the wrapper.

As far as I know, that is the solution that will produce the least amount of problems.

tilman
Oh, didn't see you added your code samples in the meantime. Just take it as it is. Hope it still helps you.
tilman
I was trying to see if there was a "pure" css way - i plan on reusing the layout all the time.
thelonesquirrely
Pure css way: set the wrapper to position: relative, set the column that is shorter to position: absolute; right: 0; top: 0; bottom: 0; (asuming the right one is the sidebar and is shorter). As I mentioned, though, this will produce some problems down the road.. What if your right col is larger all of a sudden for example?
tilman
I was hoping to get the whole thing to be the largest of the two - there is the chance that the left bar would be longer than the right. If it became unruly I would probably implement some folding. does this cover the case of a longer left bar?
thelonesquirrely
The way I wrote it is for the case that the left column is bigger than the right. If you want it reversed replace every occurrence of right with left. I would really not advise this though..
tilman
again this seems like a cludge - in general shouldn't I be able to just push the surrounding container down? I was experimenting with height: 100% but I couldn't get it down!
thelonesquirrely
The surrounding container is not the problem. With proper float clearing it will always extend to house the contained elements. The problem is, getting all the contained elements the same size. Another option would be to use ´display: table´ (Say goodbye to IE-users). Or you could use javascript to do the calculations. Generally speaking, there is no easy solution to your problem and you are definitely not the first to encounter it.
tilman
I've seen two ways to do equal height columns - have them both be grossly to long and then do some trickery to hide the spill (didn't look into this much - it sounds like a hack) and then to wrap them in a container and make that one a larger size. I think that this is what is happening here, but i just can't get them to stretch...urk.
thelonesquirrely