i'm new to coding I wanted to use Masonry to make my pictures to arranged like pinterest home page but I don't seems to understand how the Masonry code works.
Here is my pictures and my code.
I was able to retrieve all the image from the database but all the pictures stuck at the left side of the screen. What I want the page to look like this 2
<?php
// Create database connection
$db = mysqli_connect("localhost", "root", "", "drawingguide");
$sql = "SELECT * FROM images";
$result = mysqli_query($db, "SELECT * FROM images");
?>
<html>
<head>
<style>
.grid-item { width: 200px; }
.grid-item--width2 { width: 400px; }
</style>
<script src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.js"></script>
</head>
<?php
while($row = mysqli_fetch_array($result)) {
echo "<div id='container'>";
echo "<img class='item' src='images/{$row['image']} ' />";
echo "</div>";
}
mysqli_close($db);
?>
</html>