I am trying to put my footer at the bottom of my form. I have a number of pages with data input. I designed them so that they would just wrap in the page. I am afraid this will not work well for smartphone users. If I add
tags after each element, the content will be longer then one page. Thus I am looking for a way to move my footer to the bottom of the content. I saw someone with blank space as the opposite problem. No one addressed the follow up question to put the footer under the content.
I found a css solution online. It uses 4 div tags based on a container holding everything and then css to style the div tags. I tried adding it to my site and now I have a yellow header around my menu and the footer
https://talktodock.com/loads/test.php
The HTML I needed to add:
<div id="container">
<div id="header"></div>
<div id="body"></div>
<div id="footer"></div>
</div>
the css:
html,
body {
margin:0;
padding:0;
height:100%;
}
#container {
min-height:100%;
position:relative;
}
#header {
background:#ff0;
padding:10px;
}
#body {
padding:10px;
padding-bottom:60px; /* Height of the footer /
}
#footer {
position:absolute;
bottom:0;
width:100%;
height:60px; / Height of the footer */
background:#6cf;
}
IIs there a more simple solution or way to make this work within my existing code?
******************* the header file *********************
<?php
if(!isset($_SESSION['sessionID']))
{
session_start();
}
$dir = basename(getcwd());
$dir = basename(getcwd());
if ($dir !=="loads")
{
chdir("../");
}
require_once 'database.php';
?>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="https://talktodock.com/loads/">
<title> Menu </title>
<link rel = "stylesheet" href="style.css">
<link r.dygel = "stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div id="container">
<div id="header">
<header>
<ul>
<li><a href="login.php">LOGIN</a></li>
<li><a href="register.php">REGISTER</a></li>
</ul>
</header>
<div class = "menu-bar">
<ul>
<li class = "active"><a href="index.php"><i class="fa fa-home"></i>Home</a></li>
<li><a href="#"><i class="fa fa-home"></i>Loads</a>
<div class="sub-menu-1">
<ul>
<li><a href="myload.php"><i class="fa fa-home"></i>Current</a></li>
<li><a href="assignload.php"><i class="fa fa-home"></i>Assign</a></li>
<li><a href="loadstatus.php"><i class="fa fa-home"></i>Change Status</a></li>
<li><a href="attach.php"><i class="fa fa-home"></i>Attachments</a></li>
<li><a href="bol.php"><i class="fa fa-home"></i>Upload BOLs</a></li>
<li><a href="repower.php"><i class="fa fa-home"></i>Driver Repower</a></li>
<li><a href="viewload.php"><i class="fa fa-home"></i>View Multiple</a></li>
<li><a href="searchloadid.php"><i class="fa fa-home"></i>Search</a></li>
</ul>
</div>
</li>
<li><a href="#"><i class="fa fa-home"></i>Business</a>
<div class="sub-menu-1">
<ul>
<li><a href="openbuslog.php"><i class="fa fa-home"></i>Log</a></li>
<li><a href="addbusiness.php"><i class="fa fa-home"></i>Add</a></li>
<li><a href="searchbus.php"><i class="fa fa-home"></i>Search Names</a></li>
<li><a href="searchbuslog.php"><i class="fa fa-home"></i>Search Logs</a></li>
<li><a href="editbus.php"><i class="fa fa-home"></i>Edit</a></li>
<li><a href="certifybus.php"><i class="fa fa-home"></i>Completion/Handler</a></li>
</ul>
</div>
</li>
<li><a href="#"><i class="fa fa-user"></i>User</a>
<div class="sub-menu-1">
<ul>
<li><a href="login.php"><i class="fa fa-home"></i>Login</a></li>
<li><a href="register.php"><i class="fa fa-home"></i>Register</a></li>
<li><a href="user2user.php"><i class="fa fa-home"></i>User 2 User TBP</a></li>
<li><a href="mylog.php"><i class="fa fa-home"></i>User Log</a></li>
<li><a href="profile.php"><i class="fa fa-home"></i>Modify Profile</a></li>
<li><a href="changerole.php"><i class="fa fa-home"></i>Toggle Role</a></li>
<li><a href="deleteprofile.php"><i class="fa fa-home"></i>Delete Profile</a></li>
<li><a href="updateuserpass.php"><i class="fa fa-home"></i>Change Pass</a></li>
<li><a href="lost.php"><i class="fa fa-home"></i>User/Pass Help</a></li>
<li><a href="userupload.php"><i class="fa fa-home"></i>New Driver Pic</a></li>
</ul>
</div>
</li>
<li><a href="#"><i class="fa fa-help"></i>Help</a>
<div class="sub-menu-1">
<ul>
<li><a href="test.php"><i class="fa fa-home"></i>Who Am I</a></li>
<li><a href="users/users.htm"><i class="fa fa-home"></i>Test Users</a></li>
</ul>
</div>
</li>
<li><a href="#"><i class="fa fa-people"></i>About Us</a>
<div class="sub-menu-1">
<ul>
<li><a href="contact.php"><i class="fa fa-home"></i>Contact Us</a></li>
</ul>
</div>
</li>
</div>
******************* the footer file *********************
</body>
<div id="footer">
<footer>
<?php
$dir = basename(getcwd());
if ($dir !=="loads")
{
chdir("../");
}
if(isset($_SESSION['sessionLoadID']))
{
echo "Your current load is: " . $_SESSION['sessionLoadID'] . " Status: " . $_SESSION['sessionidStatus'];
}
else
{
echo "You have no load assigned";
}
?>
<p> Copyright 2021 by Michael Macgowan Become a <a href = "https://www.patreon.com/user?u=54106673&fan_landing=true">Patreon</a> supporter. <a href= "termsofservice.php">Terms and Conditions</a> version 0.555</p>
</footer>
</div>
</div>
</html>
******************* the css file *********************
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
header {
width: 100%;
height: 18px;
background-color: rgb(0,100,0);
box-shadow: 0 0 10px #000;
text-align: right;
text-decoration-color: #000000;
margin: 0 auto;
}
header a {
color: #ffffff;
}
}
header a:visited{
color: #ffffff;
}
body {
margin:0;
padding:0;
height:100%;
background-image: url(background.jpg);
background-size: cover;
background-position: center;
font-family: sans-serif;
font-Weight: bold;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
padding: 2px;
}
}
.menu-top {
text-align: right;
background-size: cover;
background-color: rgb(0,100,0);
height: 12px;
}
.menu-top li {
display: inline;
text-decoration-color: #fff;
}
.menu-top li a:visited {
color: #fff;
}
.menu-bar {
background: rgb(0,100,0);
text-align: center;
}
.menu-bar ul {
display: inline-flex;
list-style: none;
color: #fff;
}
.menu-bar ul li {
width: 135px;
margin: 15px;
padding: 15px;
}
.menu-bar ul li a {
text-decoration: none;
color: #fff;
}
.active, .menu-bar ul li:hover {
background: #2bab0d;
border-radius: 3px;
}
.menu-bar .fa {
margin-right: 8px;
}
.sub-menu-1 {
display: none;
}
.menu-bar ul li:hover .sub-menu-1 {
display: block;
position: absolute;
background: rgb(0,100,0);
margin-top: 15px;
margin-left: -15px;
}
.menu-bar ul li:hover .sub-menu-1 ul {
display: block;
margin: 10px;
}
.menu-bar ul li:hover .sub-menu-1 ul li {
width: 150px;
padding: 10px;
border-bottom: 1 px dotted #fff;
background: transparent;
border-radius: 0;
text-align: left;
}
.menu-bar ul li:hover .sub-menu-1 ul li:last-child {
border-bottom: none;
}
.menu-bar ul li:hover .sub-menu-1 ul li a:hover {
color: #b2ff00;
}
.fa-angle-right {
float: right;
}
.sub-menu-2 {
display: none;
}
.hover-me:hover .sub-menu-2 {
position: absolute;
display: block;
margin-top: -40px;
margin-left: 140px;
background-color: rgb(0, 100, 0);
}
footer p {
text-transform: uppercase;
text-align: center;
}
h1 {
text-align: center;
text-transform: uppercase;
font-size: 48px;
}
p a {
color: #666;
}
input {
height: 30px;
margin: 20px auto;
text-align: center;
box-shadow: 0 0 10px #666;
background-color: #f2f2f2;
}
textarea {
width: 240px;
height: 340px;
}
button {
height: 30px;
margin: 0 auto;
text-align: center;
background-color: #000000;
color: #ffffff;
}
form {
text-align: center;
}
#container {
min-height:100%;
position:relative;
}
#header {
padding:10px;
}
#body {
padding:10px;
padding-bottom:60px; /* Height of the footer */
}
#footer {
position:absolute;
bottom:0;
width:100%;
height:60px; /* Height of the footer */
background:#6cf;
}
i have messed with this all afternoon and haven’t got anywhere.