Member Avatar for BloccPrince

Hi,

I have a page that gets adverts and an image from mysql database. Getting the results is no problem.
How do I make use of css to align each advert next to each other as opposed to every advert under one another.

I also have a problem of the results going over the footer.

 while ($row = mysqli_fetch_assoc($sports)) {        

          echo "<b>" . $row['AdvertTitle'] . "<br/>";
          echo "<b>R <b/> " . $row['Price'] . "<br/>";
          echo "<b>" . $row['Description'] . "<br/>";         
          echo "<b></b><br/> <a href='" . $row['Link'] . "'><img src='" .$row['Link'] . "' width='150px;' height='150px'/></a><br/><br/>";
             }



 .categories
{
 height: 500px;
 width: 970px;
 margin-left: 5%;
 margin-top: 5%; 

}

Thanks,

Prince

maybe you should try out this

while ($row = mysqli_fetch_assoc($sports)) {   
        echo "<div class='category'>";
          echo "<b>" . $row['AdvertTitle'] . "<br/>";
          echo "<b>R <b/> " . $row['Price'] . "<br/>";
          echo "<b>" . $row['Description'] . "<br/>";         
          echo "<b></b><br/> <a href='" . $row['Link'] . "'><img src='" .$row['Link'] . "' width='150px;' height='150px'/></a><br/><br/>";
         echo "</div>";    }

.category{
    width: 30%;
    display: inline-block;
    vertical-align: top;
    *display: inline;
    *zoom: 1;
}

and add overflow:hidden; to .categories.

Hope can solve your question. And, this question should be posted in CSS section. Thanks

Member Avatar for BloccPrince

Thanks, I modified the code you gave me and managed to get it to work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.