I made this page print out a table of cars. It prints about 13 cars in a long table with pictures. Every page has a footer and it works fine but on the page where all cars are printed(the longest), it ends up somewhere in the middle. Anyone who could help me fix this?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Home</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<center><div id="squareUnderLogo"><img src="images/logo.png" alt="Logo";></div></center>
<div id="logOutBtn" align="right"><a href="logout.php"><input type="submit" value="Log out" /> </a></div>
<?php
$servername = "localhost";
$username = "root";
$password = "usbw";
$dbname = "cars";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT id, plate, car, foto FROM cars";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<center><br><br><br><br><br><table border='1px solid black'></center>";
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td width='338'>" . $row['foto'] . "</td>";
echo "<td> <b>Naam:</b> " . $row['car'] . " <br><b>License plate:</b> " . $row['plate'] . "<br><b>Dealer:</b> " . "<br><b>Employee:</b> " . "<br><b>Workplace number:</b> " . "<br><b><i><a href='maintence.php' style='color: #000000'>Maintence>></a><i></b>" . "</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "No results.";
}
$conn->close();
?>
<footer><hr><div align="right">Car DB <br><i>©Designed by Firstname Lastname 2016</i> </div> </footer>
</body>
</html>
CSS for the footer:
footer {
font-family: 'Arial';
font-size: 90%;
width:100%;
height:100px;
position:absolute;
bottom:0;
left:0;
}
This is working for me:
Add this on same php page.
<style>
footer {
font-family: 'Arial';
font-size: 90%;
width:100%;
height:100px;
position:absolute;
left:0;
}
</style>