-
AuthorPosts
-
June 22, 2020 at 6:08 pm #1224650
I have a page with a grid row and 9 one-fourth elements (images).
On desktop there are 4 images per row, as it should be.
For tablet size, the 4 elements per row become 2 elements per row. So far so good.
Except, the last (9th element, styled exactly like the others), suddenly becomes very small (about 1/3 of the normal size of the others).
Then on phone size (elements go full width) everything is fine again.I have been searching like crazy for what could be causing this, but so far no luck.
I found this css in an earlier post here and adjusted it a bit:
/* Adjust last section/element on Info grid row page too small on tablet */ @media only screen and (max-width:1024px) and (min-width:768px) { #top.page-id-620 .av-layout-grid-container .av_one_fourth { padding: 10px 0 !important; width: 47.5%; display: block; /* float: left; */ } #top.page-id-620 .av-layout-grid-container .av_one_fourth:nth-child(2n+1) { clear: both; } }
Almost there, but now there is too much space now between the 2nd and 3rd row and the 4th and 5th row on tablet.
Can’t seem to get it right. Any help is appreciated for a better solution.Regards,
RobLinks in Private details
June 23, 2020 at 8:59 pm #1224945I fixed it like this for now:
/* Fix last section/element on 4col grid row page too small on tablet */ @media only screen and (max-width:1024px) and (min-width:768px) { #top.page-id-620 .av-layout-grid-container .av_one_fourth { width: 46%; margin: 2% 2%; display: block; float: left; } div.flex_column_div:nth-child(5), div.flex_column_div:nth-child(6), div.flex_column_div:nth-child(9) { margin-top: 2% !important; } div.flex_column_div:nth-child(2n) { margin-right: 2% !important; } }
If there is a better way, please share.
You may want to incorporate some kind of fix for this in the next version of the theme.Kind regards,
RobBy the way, there is a similar strangeness in the 5col grid, so please look at that as well. :-)
Added comment 2020-06-24:
Just discovered that this suddenly also applies to subpages of that page, even though I target just the parent…Why? How to fix?- This reply was modified 4 years, 6 months ago by rob2701. Reason: Added comment about CSS suddenly also applying to subpages
June 24, 2020 at 2:04 pm #1225199Hi rob2701,
Can you please give us the child page link that gets affected too?
Best regards,
VictoriaJune 24, 2020 at 2:09 pm #1225204Hi Victoria,
Sure, forgot to do that. It’s in the private field with a small explanation.
Kind regards,
Rob- This reply was modified 4 years, 6 months ago by rob2701. Reason: Added explanation for subpages behaviour
June 24, 2020 at 8:11 pm #1225329Hi Rob,
Best regards,
VictoriaJune 24, 2020 at 10:18 pm #1225361Hi Victoria,
Yes of course it does, for me too, with the desktop size (4 elements per row).
The problem is with the tablet size (2 elements per row), like I wrote above. Jusr resize the browser window, you will see the issue.
Again, desktop and phone sizes are fine. Tablet size is the issue.
With the tablet size, you see the 9th element become much smaller than the others.
And when you apply the CSS (uncomment it at the bottom of Quick CSS), then you will see that size and the padding is all fixed, but then the subpages get a very narrow content space.Kind regards,
RobAdditional info:
This ONLY happens with 5 or 9 or 13 elements, strangely enough, so at the exact points of the desktop 4-per-row+1. When you clone the last element however, so to get 6, 10, 14 elements, everything is fine again, even with the tablet size. Then the only remaining issue is the top-margin between the original desktop-4-per-row even on the tablet-2-per-row. Which can be easily fixed with CSS.
But it seems the problem is there with 4n+1 on the tablet-size view (obviously when you use one_fourth elements like me).
When using one_fifth element the same logic applies, but then for 5n+1.- This reply was modified 4 years, 6 months ago by rob2701. Reason: Added still more testing info of when this issue happens on tablet size view
June 25, 2020 at 4:33 pm #1225579Hi rob2701,
Here is the code you can put in Enfold > General Styling > Quick Css, if it does not work, put into themes/enfold/css/custom.css
@media only screen and (max-width: 989px) and (min-width: 768px) { #top.page-id-620 #av-layout-grid-1 div .av_one_fourth { width: 48%; } }
If you need further assistance please let us know.
Best regards,
VictoriaJune 25, 2020 at 4:56 pm #1225593Hi Victoria,
Thanks, that works well. But I also had to add some CSS to that, because as I mentioned above, the groups of 4 otherwise have too much margin between them (retained from the desktop size view) compared to the groups of 2 in the tablet size view:
/* Adjust last section/element on INFO grid row page too small on tablet */ @media only screen and (max-width: 989px) and (min-width: 768px) { #top.page-id-620 #av-layout-grid-1 div .av_one_fourth { width: 48%; } div.flex_column_div:nth-child(5), div.flex_column_div:nth-child(6), div.flex_column_div:nth-child(9), div.flex_column_div:nth-child(10) { margin-top: 30px; } }
Because I always like to understand why this happened in the first place like I described above (only the very last 4n+1 element becoming a smaller size), can you explain? I fail to see how that percentage setting could affect only that last element — I did not change that with CSS anywhere, except when trying to fix the issue on tablet view :-)
see #1225329 above, this happened without any of the tried fixes from my part:
Additional info:
This ONLY happens with 5 or 9 or 13 elements, strangely enough, so at the exact points of the desktop 4-per-row+1. When you clone the last element however, so to get 6, 10, 14 elements, everything is fine again, even with the tablet size. Then the only remaining issue is the top-margin between the original desktop-4-per-row even on the tablet-2-per-row. Which can be easily fixed with CSS.
But it seems the problem is there with 4n+1 on the tablet-size view (obviously when you use one_fourth elements like me).
When using one_fifth element the same logic applies, but then for 5n+1.I notice that in my previous fix attempt I used the wrong media query for tablet, but that has nothing to do with the issue itself.
And also, is this something that will be included in a next update?Thanks for your help,
Rob- This reply was modified 4 years, 6 months ago by rob2701. Reason: Added questions
June 25, 2020 at 5:32 pm #1225623June 25, 2020 at 6:35 pm #1225640Hi Victoria,
I think I understand it now, somehow the last row in the tablet view adapted to a minimum width by not having it specifically set. Still strange that every time 1 more element added solved it too…
It’s understandable you did not see the issue before, someone would have to have tried (like I did) exactly 1 more element than the number of desktop view rows created by the chosen number of elements per row in the desktop view (whether 3, 4, 5 or 6). I mean what are the odds?
I just happened to stumble upon it by chance :-)Thanks for your patience and help! Issue solved, you can close this one.
Rob- This reply was modified 4 years, 6 months ago by rob2701.
June 26, 2020 at 3:14 pm #1225861Hi Rob,
Glad you got it working for you! :)
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- The topic ‘Grid row tablet strangeness’ is closed to new replies.