I am following a tutorial from PHPacademy.org about showing images in a directory; a very simple image gallery. Here is the link to the tutorial: http://www.youtube.com/watch?v=b4JrEYTfm5M
I have a small issue that images overlap with the footer, I asked this on their forum but couldn't get a reply that's why I am asking here.
I want to list images horizontally, not vertically, so that I will have 2 or 3 images in one row on my small screen. I tried to add some style but the gallery overlaps the footer. Here are the codes I am using:
The file where I will display images:
images.php
<?php include 'includes/header.php'; ?> <div id="title">Images</div> <div id="content"> <?php $dir = "images/gallery/"; if ($opendir = opendir($dir)) { while (($file = readdir($opendir)) !== FALSE) { if ($file!="."&&$file!="..") echo "<div class='images'><a href='$dir/$file'><img src='$dir/$file' width='100' height='100' alt='' /></a></div>"; } } ?> </div> <?php include 'includes/footer.php'; ?>footer.php
<div id="footer"> <div class="copy">© <?php echo date('Y'); ?> <a href="index.php"><?php sitename(); ?></a></div> </div> </body> </html>style.css
body,div,h1,h2,hr{padding:0;margin:0} body{background-color:#dad3c2} body{font-family:Tahoma,Arial;font-size:medium;color:#000} body a{text-decoration:none} p{margin:0;padding:5px 5px 5px 5px;font-size:small;color:#34220C} img{border-style:none;vertical-align:middle} label{padding:5px 0 10px 5px;font-size:small;color:#34220C} #header{text-align:center} #logo{margin:5px 5px 5px 5px;padding:5px 0 5px 0;background-color:#b73406;border:5px solid white} #welcome{margin:0 5px 0 5px;padding:5px 0 5px 0;border:5px solid white;background-color:#382d2b;color:#f2bb00;text-align:center;font-weight:bold;text-shadow:1px 1px #000} #content{margin:0 5px 0 5px;border:5px solid white;background-color:#cfc8b7} #title{margin:0 5px 5px 5px;padding:5px 0 5px 5px;border:5px solid white;background-color:#382d2b;font-weight:bold;color:#f2bb00} #title a{color:#f2bb00} #footer{margin:5px 5px 5px 5px;padding:5px 5px 5px 5px;background-color:#cfc8b7;color:#624117;text-align:center;font-size:small} #footer a{color:#624117;text-decoration:none} #flogos{padding:5px 5px 5px 5px} .copy{padding:5px 0 5px 0} .credit{padding:5px 0 5px 0} .lang{margin:5px 5px 0 5px;padding:5px 0 5px 25px;background-color:#b73406;border:5px solid white} .langtext{padding:0 0 0 20px;color:#fff;font-weight:bold;text-shadow:1px 1px #000} .page{padding:10px 0 10px 25px;font-weight:bold;background-color:#b73406;color:#fff;border-bottom:2px solid #cfc8b7} .pagel{padding:10px 0 10px 25px;font-weight:bold;background-color:#b73406;color:#fff} .center{text-align:center} .textbold{font-weight:bold} .images{padding:10px 10px 0 10px;float:left}It seems left float on .images doesn't work properly. I can't see what I am doing wrong. Thanks for any help.