When I make the browser window smaller or access it at a smaller resolution, the sidebar goes over the footer. Like on this page:
http://tithaty.com.br/?product_cat=mantas_peseiras
I've tried every suggestion I found here on the site, but nothing worked for me.
I works if I set the min-height of the floated div beside it "coluna_direita" to the height of the sidebar, but that's not ideal, since the sidebar might change heights if I add another category. So, is there a way to set the min-height of the "coluna_direita" div to change dynamically to whatever the height of the sidebar is?
Or any other easier solutions would be great.
Thank you
Edit: It's a custom Woocommerce template
<div class="wrap_shop">
<?php
/**
* The Template for displaying product archives, including the main shop page which is a post type archive.
*
* Override this template by copying it to yourtheme/woocommerce/archive-product.php
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
get_header( 'shop' ); ?>
<?php
/**
* woocommerce_before_main_content hook
*
* @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
* @hooked woocommerce_breadcrumb - 20
*/
do_action( 'woocommerce_before_main_content' );
?>
<div id="coluna_direita">
<div class="resultados">
<?php
/**
* woocommerce_archive_description hook
*
* @hooked woocommerce_taxonomy_archive_description - 10
* @hooked woocommerce_product_archive_description - 10
*/
do_action( 'woocommerce_archive_description' );
?>
</div> <!--resultados-->
<?php if ( have_posts() ) : ?>
<?php
/**
* woocommerce_before_shop_loop hook
*
* @hooked woocommerce_result_count - 20
* @hooked woocommerce_catalog_ordering - 30
*/
do_action( 'woocommerce_before_shop_loop' );
?>
<?php woocommerce_product_loop_start(); ?>
<?php woocommerce_product_subcategories(); ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php wc_get_template_part( 'content', 'product' ); ?>
<?php /*<div id="desejos"><?php echo do_shortcode( '[yith_wcwl_add_to_wishlist] ' ); ?></div> */ ?>
<?php endwhile; // end of the loop. ?>
<?php woocommerce_product_loop_end(); ?>
<?php
/**
* woocommerce_after_shop_loop hook
*
* @hooked woocommerce_pagination - 10
*/
do_action( 'woocommerce_after_shop_loop' );
?>
<?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>
<?php wc_get_template( 'loop/no-products-found.php' ); ?>
<?php endif; ?>
<?php
/**
* woocommerce_after_main_content hook
*
* @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
*/
do_action( 'woocommerce_after_main_content' );
?>
</div> <! -- coluna_direita -->
<div id="sidebarshop">
<div id="side_content">
<?php
/**
* woocommerce_sidebar hook
*
* @hooked woocommerce_get_sidebar - 10
*/
/*do_action( 'woocommerce_sidebar' ); */
?>
<?php get_sidebar( 'shop' ); ?>
</div> <!-- side_content-->
</div> <!-- sidebarshop -->
<?php get_footer( 'shop' ); ?>
</div>
The floats are causing the problem.
A solution that doesn't require changing the HTML structure:
#container {
float: right;
width: 75%;
}
#sidebarshop {
margin-top: -5px;
width: 25%;
float: left;
background-color: #fff;
min-height: 100%; /** change from height to min-height **/
}
#coluna_direita {
/* width: 75%; - moved to container */
/* float: right; - moved to container */
padding-left: 20px;
min-height: 100%; /** change from height to min-height **/
margin-top: 15px;
}
If you can change the HTML structure use flexbox:
HTML:
<div id="content" role="main">
<div id="sidebarshop"> <!-- move into #content -->
</div>
<div id="coluna_direita">
</div>
</div>
#content {
display: flex;
}
#sidebarshop {
margin-top: -5px;
width: 25%;
/* float: left; - Remove the float **/
background-color: #fff;
/* height: 100%; - Remove the height, so the sidebar will push the flexbox down when needed **/
}
#coluna_direita {
width: 75%;
/* float: right; - Remove the float **/
padding-left: 20px;
margin-top: 15px;
}