Results 1 to 5 of 5

Thread: two column layout-- want sticky footer only on maincontent

  1. #1
    Join Date
    Apr 2015
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default two column layout-- want sticky footer only on maincontent

    I am trying to create a webpage that uses the two-column layout found on this site (http://www.dynamicdrive.com/style/la...-frame-layout/).

    I want a header and footer only on the right, which is the #maincontent side. I have the barebones set up right now so that the header image covers the entire column at the top. I am attempting to have the footer along the bottom of the column that will be "sticky."

    HTML:
    HTML Code:
    <body>
    
    <div id="framecontent">
    <div class="innertube">
    <img class="pos_top "id="rcorners" src="images/logo.jpg" style="width:150px; height:150px""
    </div>
    </div>
    
    
    <div id="maincontent">
    <img src="images/Header_1.jpg" style="width:100%; height:200px">
    <div id="footer">&copy;Copyright 2015. All Rights Reserved.</div>
    </div>
    </div>
    
    
    </body>
    CSS:
    Code:
    body{
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    height: 100%; 
    max-height: 100%; 
    }
    
    #framecontent{
    position: absolute;
    top: 0;
    bottom: 0; 
    left: 0;
    width: 200px; 
    height: 100%;
    overflow: hidden; 
    background: purple;
    color: white;
    }
    
    #maincontent{
    position: fixed;
    top: 0; 
    left: 200px;
    right: 0;
    bottom: 0;
    overflow: auto; 
    background: #fff;
    }
    
    #rcorners {
    border-radius: 25px;
    border: 2px solid orchid;
    padding: 5px; 
    width: 150px;
    height: 150px;    
    }
    
    #footer {
    background-color:purple;
    color:white;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align:center;
    padding:5px;
    }
    
    .pos_top {
    position: relative;
    top: 100px;
    }
    
    .innertube{
    margin: 15px; 
    }

    Then I tried to add a <section> to my initial page that will appear in the middle of the right column. I have been successful in getting it placed where I want it and to look like I want it to. However, when I add this <section>, my footer slides to the bottom of the left (#framecontent). What am I doing wrong.

    HTML for <section> (placed between <img> and <div id="footer"> in #maincontent above):
    HTML Code:
    <section>
    <h2 style="text-align:center; font-family:arial;">Title of Box</h2>
    <p style="text-align:center; font-family:arial;">Information text<button type="button"                 
          onclick="location.href='https://www.google.com/'">Go</button></p>
    <p style="text-align:center; font-family:arial;">Link to page<button type="button"                                                               
          onclick="location.href='Home.html' ">Home</button></p>
    </section>
    CSS for section:
    Code:
    section {
    background-color: gold;
    position: fixed;
    top: 300px;
    left: 30%; 
    width: 600px;
    border: 15px solid black;
    }
    I would really appreciate some help with this.
    Last edited by keyboard; 04-29-2015 at 12:26 PM. Reason: Format: Html Tags [html][/html], Code Tags [code][/code]

  2. #2
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    Section:
    Code:
    section {
    background-color: gold;
    position: fixed;
    top: 250px;
    left: 30%;
    padding: 10px;
    width: 40%;
    margin-left: 80px;
    border: 15px solid black;
    bottom: 50px;
    overflow: auto;
    }

  3. The Following User Says Thank You to molendijk For This Useful Post:

    MandaRyte (04-28-2015)

  4. #3
    Join Date
    Apr 2015
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Thanks, Arie. I tried this, but the footer didn't move back to the right column where I want it. This only adjusted the size of my section. I appreciate your effort!

  5. #4
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    That does not happen here. Maybe I don't understand what you mean. Here's a quick code:
    Code:
    <!doctype html>
    <html >
    <head>
    
    <title>&nbsp;</title>
    
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    
    <style>
    
    body{
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    height: 100%;
    max-height: 100%;
    }
    
    #framecontent{
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 200px;
    height: 100%;
    overflow: hidden;
    background: purple;
    color: blue;
    }
    
    #maincontent{
    position: fixed;
    top: 0;
    
    left: 200px;
    right: 0;
    bottom: 0;
    overflow: auto;
    background: #fff;
    }
    
    #rcorners {
    border-radius: 25px;
    border: 2px solid orchid;
    padding: 5px;
    width: 150px;
    height: 150px;
    }
    
    #footer {
    background-colorurple;
    color:red;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align:center;
    padding:5px;
    }
    
    .pos_top {
    position: relative;
    top: 100px;
    }
    
    .innertube{
    margin: 15px;
    }
    
    
    section {
    background-color: gold;
    position: fixed;
    top: 250px;
    left: 30%;
    padding: 10px;
    width: 40%;
    margin-left: 80px;
    border: 15px solid black;
    bottom: 50px;
    overflow: auto;
    }
    </style>
    
    
    </head>
    
    <body>
    
    <div id="framecontent">
    <div class="innertube">
    <img class="pos_top" id="rcorners" alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/f5/Eug%C3%A8ne_Ferdinand_Victor_Delacroix_043.jpg/640px-Eug%C3%A8ne_Ferdinand_Victor_Delacroix_043.jpg" style="width:150px; height:150px">
    </div>
    </div>
    
    
    
    
    
    <div id="maincontent">
    <img alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/f5/Eug%C3%A8ne_Ferdinand_Victor_Delacroix_043.jpg/640px-Eug%C3%A8ne_Ferdinand_Victor_Delacroix_043.jpg" style="width:100%; height:200px">
    <div id="footer">&copy;Copyright 2015. All Rights Reserved.</div>
    </div>
    
    
    <section>
    <h2 style="text-align:center; font-family:arial;">Title of Box</h2>
    <p style="text-align:center; font-family:arial;">Information text<button type="button"
    onclick="location.href='https://www.google.com/'">Go</button></p>
    <p style="text-align:center; font-family:arial;">Link to page<button type="button"
    onclick="location.href='Home.html' ">Home</button></p>
    <br>aa<br>aa<br>aa<br>aa<br>aa<br>aa<br>aa<br>aa<br>aa<br>aa<br>aa<br>aa<br>aa<br>aa<br>aa<br>aa<br>aa<br>aa
    
    </section>
    
    
    
    
    </body>
    
    </html>

  6. The Following User Says Thank You to molendijk For This Useful Post:

    MandaRyte (05-01-2015)

  7. #5
    Join Date
    Apr 2015
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    That worked!! Thanks so much!!

Similar Threads

  1. Sticky footer again!
    By NickNameDrive in forum CSS
    Replies: 2
    Last Post: 10-13-2010, 10:35 AM
  2. Need help with my sticky footer.
    By robin9000 in forum CSS
    Replies: 1
    Last Post: 11-08-2009, 03:37 PM
  3. Adding a column to 3-column fixed layout
    By slobjones in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 10-21-2007, 03:51 AM
  4. [CSS] Sticky Footer
    By Ryan Fait in forum Submit a DHTML or CSS code
    Replies: 7
    Last Post: 04-16-2007, 01:29 AM
  5. CSS Sticky Footer (CSS/JS)
    By wyclef in forum CSS
    Replies: 0
    Last Post: 12-13-2006, 03:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •