I have this link:
At the bottom you will find some products that are not aligned as I want.
I put a picture more clearly understand how they want to be aligned
http://i59.tinypic.com/1zfh0dc.jpg
CODE PHP:
<div class="container">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 6,
);
$products = new WP_Query( $args );
if( $products->have_posts() ) {
while( $products->have_posts() ) {
$products->the_post();
?>
<?php
$check = get_field('featured_product');
if($check[0] == 'Check'){ ?>
<div class="featured_product">
<?php the_post_thumbnail('featured'); ?>
<div class="featured_content center">
<h3><?php the_title() ?></h3>
<div class='content'>
<?php the_excerpt() ?>
</div>
<a href="?page_id=26" class="get_quote">get quote</a>
</div>
</div>
<?php } ?>
<?php
}
}
else {
echo 'No products!';
}
?>
</div>
</div>
CODE CSS:
.featured_product{
width:28%;
float:left;
max-width:300px;
min-width:300px;
margin-right:6%;
border:3px solid #d3d1d1;
margin-bottom:30px;
border-radius:0 0 20px 20px;
padding-bottom:30px;
height:468px;
}
I have tried to make these changes but still does not align as they should.
.featured_content{
padding:0 30px;
position: absolute;
bottom: 0;
}
.featured_product{position:relative;}
No matter how much content is added, it must be lined all the same. As you can see, products that have no image or long text are not displayed properly.
Can you help me find a solution to this problem?
Thanks in advance!
You can use absolute position and set the
box-sizing
of.featured_content
toborder-box
to makes it rendered correctly. Try this:EDIT
If you want to makes the title and content in same alignment, and the quote button in same alignment, you need to wrap the image with
div
and add static height to that div. Also wrap theget_quote
button and set the wrapper to absolute position. Example:HTML
CSS
If you are seeking for an easy answer then you can go with an img div where either you can put image or you can give min height. In your example, i added this and it was ok
You can use it in parent class, to get all in center
Give the
.featured_content
class a margin-top if it isnt preceded by a img taghttp://www.w3schools.com/cssref/css_selectors.asp
All you need is the
.content
div should have minimum height, so, that theGet Quote
should be vertically aligned accordingly.Apply this style rule:
Adjust the height accordingly.
Add
in to your
and
in
position relative cannot float just put a div around it and make it float left.