Revolutsio Posted May 31, 2022 Share Posted May 31, 2022 I have got four images side by side and would like to have the name of the image below, but when i try the following code it puts the text of the image next to the image <div> <?php foreach($games as $game): ?> <?php echo "<img class='img' src='images/" . $game['image'] ."' >"?> <?php echo $game['game']?> <?php endforeach; ?> </div> Quote Link to comment https://forums.phpfreaks.com/topic/314867-text-below-image/ Share on other sites More sharing options...
Barand Posted May 31, 2022 Share Posted May 31, 2022 Put each image/text pair in a div. Position with a grid layout or with left float. Quote Link to comment https://forums.phpfreaks.com/topic/314867-text-below-image/#findComment-1596882 Share on other sites More sharing options...
maxxd Posted May 31, 2022 Share Posted May 31, 2022 There was a div around each image in your other (I assume) related thread. Put it back and do as Barand recommends - in fact, if you use the CSS setup I recommended you can just add this to the .block definition: display: flex; flex-direction: column; Quote Link to comment https://forums.phpfreaks.com/topic/314867-text-below-image/#findComment-1596901 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.