-
AuthorPosts
-
September 9, 2020 at 12:08 am #1244489
Is there a way to make a flex container? I have a 3 column row and I want the content to be the same height. I want the shorter content to stretch and fill the container.
Thank you.
September 9, 2020 at 12:15 am #1244492Hey svreatt,
It would have to be done via css. Please see the following:
Whil the link is dealing with 6 columns. The code can be reverse engineered to work within 3 columns.
Best regards,
Jordan ShannonSeptember 9, 2020 at 12:42 am #1244510Thanks, that’s a bit tough for me to figure out.
What i want it the photo in the left column to be at the bottom of the column.
Thanks
September 11, 2020 at 1:35 am #1245030I updated the css to this.
For some reason when I add Add a color section with custom ID “av-extra-columns”.
The section doesn’t seem to read the css./*—————————————-
// Create Flex Columns
//————————————–*/#av-extra-columns .entry-content-wrapper {
display:flex;
height:100vh;
flex-wrap:wrap;
align-content:stretch;
}
#av-extra-columns .column-top-margin {
margin-top: 0 !important;
}
#av-extra-columns .flex_column {
width: 33%;
flex-basis: 33%;
margin-left: 2%;
margin-top: 20px!important;
}
#av-extra-columns .flex_column.first {
clear: none!important;
margin-left: 2%;
}September 13, 2020 at 8:04 pm #1245537Hi svreatt,
Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
Best regards,
VictoriaSeptember 14, 2020 at 11:54 pm #1245884Here are a couple of screen shots to help better explain what I want to achieve.
The first screen shot shows all of the content in the 3 rows is the same height, it fills the column.
The second screen shows how the content is normally displayed with each column having different heights.
I would like to use flex columns to achieve this.
Thanks
https://prorecoveryrx.com/wp-content/uploads/2020/09/Screen-Shot-2020-09-14-at-5.50.15-PM.png
https://prorecoveryrx.com/wp-content/uploads/2020/09/Screen-Shot-2020-09-14-at-5.50.24-PM.png
September 17, 2020 at 2:17 pm #1246536Hi,
Sorry for the late reply and thanks for the screenshots and link to your page, I don’t believe that the custom css above is going to be the solution, as I understand your question, which is to have all 3 columns display the same height for each inner element, this is the goal, correct?
So the equal height flex columns addresses the outer height, but your issue is the inner height.
In each column you have an image, text, HR, price, and a button. Of all of these, the text element is the one element that will have a different height for each column, so if you add a custom class to the text element in each column the same height can be applied to each with css or js.
Please give this a try. Do you have a test page that looks more like your screenshots?Best regards,
MikeSeptember 17, 2020 at 2:52 pm #1246548Thank you. I’m glad to try it out.
Which code should I be using?
Thanks
September 18, 2020 at 12:58 pm #1246797Hi,
If you add a custom class to the text element in the middle of the second & third columns, such as “custom-class” you could use this css:.custom-class { min-height:220px; }
Without the custom class the css would look like this for your test page second & third columns:
#top.page-id-742 #main > div > div > main > div > div > div.flex_column_table > div > section:nth-child(3), #top.page-id-742 #main > div > div > main > div > div > div.flex_column_table > div > section:nth-child(3) { min-height:220px; }
I noticed that in your second column, the HR, above the price, has a 30px top margin, so you will want to remove this to match the third column.
Best regards,
MikeSeptember 25, 2020 at 6:22 pm #1248494Thank you very much.
Is there a way to use the flex volume so I don’t have to guess at which height will work for each content box?
September 26, 2020 at 9:51 pm #1248721Hi,
Not in this situation. I checked your other pages in your “Supplements” menu to see if there is a way to have each of these columns have the same height for the text block element across these pages and it can be achieved with the following script. Try adding this code to the end of your functions.php file in Appearance > Editor:function custom_equal_height_row_script(){ ?> <script> (function($){ $(window).load(function(){ (function() { var currentTallest = 0, currentRowStart = 0, rowDivs = new Array(); function setConformingHeight(el, newHeight) { el.data("originalHeight", (el.data("originalHeight") == undefined) ? (el.height()) : (el.data("originalHeight"))); el.height(newHeight); } function getOriginalHeight(el) { return (el.data("originalHeight") == undefined) ? (el.height()) : (el.data("originalHeight")); } function columnConform() { $('.hr-custom.hr-center.hr-icon-no.el_after_av_textblock').css({'margin-top':'0'}); $('.flex_column.av_one_third section:nth-of-type(2)').each(function() { var $el = $(this); var topPosition = $el.position().top; if (currentRowStart != topPosition) { for(currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) setConformingHeight(rowDivs[currentDiv], currentTallest); rowDivs.length = 0; currentRowStart = topPosition; currentTallest = getOriginalHeight($el); rowDivs.push($el); } else { rowDivs.push($el); currentTallest = (currentTallest < getOriginalHeight($el)) ? (getOriginalHeight($el)) : (currentTallest); } }); for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { setConformingHeight(rowDivs[currentDiv], currentTallest); } } $(function() { columnConform(); }); })(); }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_equal_height_row_script');
While this works for your six pages I would recommend adding custom classes to each of the columns so there won’t be any conflicts with other columns.
Best regards,
MikeSeptember 28, 2020 at 7:09 pm #1249127Thank you. I see what you mean, it makes all the columns on the page the same size, even the second row ends up the same length as the first row.
I’ll try adding the class as you suggested.
Thanks again.
September 28, 2020 at 7:10 pm #1249129I forget to ask what that custom class would look like.
September 30, 2020 at 1:30 pm #1249633Hi,
Sorry for the late reply, if you use the custom classcehrs
then you would change the line above:
$('.flex_column.av_one_third section:nth-of-type(2)').each(function() {
to
$('.cehrs section:nth-of-type(2)').each(function() {
After applying the changes, please clear your browser cache and check.Best regards,
Mike -
AuthorPosts
- You must be logged in to reply to this topic.