Dynamic Image / Data Alignment PHP MySQL
Everything is morning
I have an alignment problem.
I am using MYSQL array to create a sport profile page.
I want it to display the image and then to the right, show their name, position and number below each other.
Then I want it to dynamically display 3 or 4 of them next to each other before moving on to the next line.
I managed to get it to only work with pictures, not text in between. they are all just displayed on new lines for the time being.
<style>
#container .profile{
display: inline-block;
vertical-align:top;
}
</style>
<div class="profile">
<img src="wp-content/uploads/profile/jh7.jpg" alt="" /><br />
<h3 class="widget-title">Player 1</h3>
<p>Defence</br>#7</br></br>
<img src="wp-content/uploads/profile/dw21.jpg" alt="" /><br />
<h3 class="widget-title">Player 2</h3>
<p>Defence</br>#21</br></br>
<img src="wp-content/uploads/profile/pn22.jpg" alt="" /><br />
<h3 class="widget-title">Player 3</h3>
<p>Defence</br>#22</br></br>
</div>
</div><!-- .entry-content -->
</div>
Thanks guys,
source to share
Quick example: float images and clear floats with a block element having a property clear: both
:
http://jsfiddle.net/L8jtwkw1/2/
You can wrap each profile in a container and use an inline block to list them horizontally.
source to share
You can float on the left for the image:
<style>
.profile img{
float: left;
margin-right: 5px;
}
</style>
Checkout this DEMO: http://jsbin.com/jigotamamu/1/
source to share
I think the problem is with the tag <h3>
- you need to either replace it with <span>
or override the styles for it.
For example:
echo '<img src="wp-content/uploads/profile/'.$row['Id'].'.jpg" alt="" />',
'<span class="widget-title">'.$row['FirstName'].' '.$row['Surname'].'</span>',
$row['PositionLong'].'</br>',
'#'.$row['Number'].'</br>';
If you are showing css styles for widget-title
we can help you.
source to share