Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to make div footer bar stays at the bottom of screen

Posted on 2010-09-20
7
Medium Priority
?
1,283 Views
Last Modified: 2012-05-10
we're making a simple iphone app where the whole app is actually a website packaged into an iphone app. We have is that we created a footer bar using div that suppose to stay at the bottom of the screen, when the page is scrolled up and down. Prob is the footer bar tends to follow the motion of the scrolling.

How do we force the footer bar to stay at the bottom? screenshot
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name = "viewport" content = "initial-scale = 1.0; width=device-width" />
<title>Scherziaparte - Invia il tuo video</title>
<link href="menuLink.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div style="z-Index:1000;position:fixed;width:300;height:80px;text-align:center; top:0%;">
<?php require_once "headerIphone.php"; ?>
<?php require_once "menuLink.php"; ?>
</div>
<table width="300" height="83" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td></td>
  </tr>
</table>
<table width="300" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
      <table width="300" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          
        </tr>
      </table>
      
      <table width="300" height="300" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td valign=top>
          <!-- Scroll bar-->
          <!--<div id=ajaxLink class="tab_container" style="position:absolute; width:300px; height:300px; background-color:#ffffff; overflow:auto;">
          -->
          <div id=ajaxLink class="tab_container" >
          <table width="300" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td></td>
  </tr>
</table>                              
            <?php require_once "video.php"; ?>

            
                                  </div>     
          </td>
        </tr>
      </table>
      <div style="z-Index:1000;position:fixed;width:300;height:480;text-align:center; bottom:0%; padding-left:1px">
      <?php require_once "advertisment.php"; ?>
      <?php require_once "footer.php"; ?>
      </div>
</td>
  </tr>
</table>
<p>&nbsp;</p>
</body>
</html>

Open in new window

0
Comment
Question by:melwong
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 

Expert Comment

by:17Red23
ID: 33722182
You need to create set the body height to 100% with a bottom margin the size of the footer (eg -200px).

Try a layout something like this:

HTML file:

<head>
      <link type="text/css" rel="stylesheet" href="new.css">
      <!—[if lt IE 7]>
            <link rel="stylesheet" type="text/css" href="ie6.css" />
      <![endif]—>
</head>
<body>
<div id="container">
    <div id="header">Header</div>
    <div id="nav">
      <ul>
        <li><a href="#">Home</a></li>
        <li><a href="#">Page 1</a></li>
        <li><a href="#">Page 2</a></li>
      </ul>
      </div>
<div id="content">Content Here.</div>
  <div class="clearfooter"></div>
</div><!—End Container—>
<div id="footer">Footer Here.</div>


CSS (new.css):

html, body {
height: 100%;
}
#container {
min-height: 100%;
margin-bottom: -200px;
position: relative;
}
#footer {
height: 200px;
position: relative;
}
.clearfooter {
height: 200px;
clear: both;
}
#container {
height: 100%;
}

0
 
LVL 6

Assisted Solution

by:Joshua_Peters
Joshua_Peters earned 150 total points
ID: 33722185
css would be
#footer {position: relative;
      margin-top: -150px; /* negative value of footer height */
      height: 150px;
      clear:both;}
0
 
LVL 3

Expert Comment

by:LouSch7
ID: 33722194
See the attached document.  I have not done much programming for the iPhone but from what I understand basic HTML and CSS rules should apply (at least the ones that Safari would normally adhere to).

I also tested this by viewing it on my iphone; you can test for the time being here (http://sscharlau.com/test.php) and it worked fine.  You'll have to use two fingers in order to slide the content however (information about that can be found here: http://darklaunch.com/2009/05/11/iphone-css-overflow-overflow-x-overflow-y-support)

Ultimately I believe what you may have been missing was an overflow tag as without it, the div doesn't know when to stop expanding.

let me know
test.php
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 4

Expert Comment

by:acashok
ID: 33722623
0
 

Author Comment

by:melwong
ID: 33750844
We tried all the above prior to posting this question and all didn't work. The prob is the footer stayed when the page is viewed in browser like FF, IE, Safari, but not in IPhone.
0
 
LVL 3

Accepted Solution

by:
LouSch7 earned 150 total points
ID: 33756952
0
 

Author Closing Comment

by:melwong
ID: 33873147
Prob solved.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
After hours on line I found a solution which pointed to the inherited Active Directory permissions . You have to give/allow permissions to the "Exchange trusted subsystem" for the user in the Active Directory...
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question