This question already has answers here:
Why does Chrome 80 cause this grid-template-rows: auto problem
(2 answers)
Closed 3 years ago.
I have a page with four forms. Each form's layout is defined using the following CSS grid configuration, which is shared between all of the forms:
.base-grid-wrapper {
display: grid;
grid-template-columns: repeat(12, 1fr);
grid-row-gap: 1em;
grid-column-gap: 1em;
width: 75%;
}
Since Chrome 80 was released, the styling for the first of these forms has been (sort of) broken. The computed values for grid-template-columns is non-uniform, but only for the first of the four forms. For the following three forms--which use the same base grid definition--the grid's columns are uniformly sized, which is what I expect when using repeat(12, 1fr) as I have. Before Chrome 80, this was not the case: all of the form's grids had uniformly-sized columns.
In other browsers (Safari and Firefox), the columns render as expected. Is there something that changed in Chrome 80 that would have caused this? Searching through the Chrome changelog, I can't seem to find anything relevant.
I've tried to see if there are any wider-scoped CSS rules that might be causing this, but I can't find anything. I admit I'm not the most advanced CSS user, so I definitely could have configured the grid incorrectly, or something, but look at the Stackblitz linked below to see if this is the case.
I saw a couple of other similar Stackoverflow questions, but none of them seem to quite fit the problem I'm seeing:
CSS grid behaviour different in Chrome and Firefox
--> perhaps most similar to my problem, but doesn't have any relevant solutions, but it does have confirmation of the problem
Has anybody faced issue working with Chrome 80 and CSS Grid
--> similar to my problem, but it doesn't have a good working example of the problem, and thus it doesn't have any useful responses
Why does Chrome 80 cause this grid-template-rows: auto problem
--> very different configuration than in my case, so not super relevant to what I'm seeing
For what it's worth, this is an Angular 8 application using Angular Material, but I'm pretty certain that that's not the source of this problem, especially considering it works as intended in other browsers.
Here's a Stackblitz that replicates the problem (be sure to open in Chrome 80+): editable & (inspectable) hosted app.
Here are some screenshots, as well:
First form
Chrome Devtools - grid outline
Firefox Devtools - grid outline
Chrome Devtools - non-uniformly-computed grid column widths
Later form, using the same base grid definition
Chrome Devtools - grid outline
Chrome Devtools - uniformly-computed grid column widths
You issue is almost similar to the question you linked1 (where I also answered) and it has to do with how chrome is dealing with 1fr which is equal to minmax(auto,1fr).
Using minmax(0,1fr) seems to fix the issue but I need to dig more in order to identify why. It's either a bug or they changed the way minmax() is calculated.
will update with the bug report or the detailed explanation
1: That questions deals with a row configuration where we need to do the opposite. Use 1fr (minmax(auto,1fr)) instead of minmax(0,1fr)
I had the same problem this morning. I had the bug reported on one of the pages I am responsible for, for the latest chrome version at that time.
I made sure I had the latest chrome installed and went to check the issues this morning and 1fr was really not being respected. Maybe 15 minutes ago I went on ahead to report the chrome bug and there it was new update pending, so I've updated the chrome again, second time today, and problem was fixed.
I did some digging and I am pretty sure they did change how css grid is handled, more specifically:
[css-grid] Accommodate spanning items crossing flexible tracks
But since it caused breakage across the web they reverted the change.
I think it's referenced here https://chromium.googlesource.com/chromium/src/+/b1738fb61215bb8610e08f65de4d01681e250f7f.
Edit: There is also this answer that goes into more details for others having this issue
https://stackoverflow.com/a/60284361/12285468
Related
After a few of my customers upgraded to Chrome v72 they've noticed a few layout issues that were not present in <= v71. From what I've found it mostly occurs when having an element with overflow: auto or overflow: scroll within a parent element that is using flexbox to position its children.
Is anyone else experiencing this? Note this is only occurring in v72, I've tested < 72 and other webkit browsers and can't reproduce it.
Looks like Chrome renders flex boxes with overflows differently since v72. At least parts of those changes were intentional to make Chrome more compliant to the spec and other browsers.
See this issue for details:
https://bugs.chromium.org/p/chromium/issues/detail?id=927066
Update:
We've heard you loud and clear and have decided to revert the change in Chrome 72 to avoid breaking existing sites and to allow developers a bit more time to update their pages.
The change will instead ship with Chrome 73. As such it's still important to make the required changes to avoid breaking it in future versions of Chrome and to ensure compatibility with Firefox.
2019-02-05 22:44:28 UTC
Seems like this shipped in Chrome 73, confirmed by a.xin's answer above.
The quick and dirty fix that worked for me is adding "min-height: 0" to all of the flex children.
On my website, http://reefbulk.shop/?page_id=1438, you can see 4 articles. They are normally lined up (as on the home page), but for some mysterious reason, they are not on some pages (such as page_id=1438).
I believe I can fix it with CSS, however adding a margin doesn't seem to help.
I hope someone here knows how to fix this infuriating issue. Last time I had it (on my other non-test site), I just made all the images the same dimensions. This has now failed in this new theme I'm using.
Asking the theme maker is no option as they give no support if your membership runs out (which it has).
You could display your articles as grids, using the following CSS on your articles.
display: grid;
align-content: space-between;
This question already has answers here:
Browser support for CSS Grid
(2 answers)
Closed 5 years ago.
I'm using CSS grid for my layout, and testing it in Chrome and Firefox everything works great. I have a 4 column layout with both row- and column-gaps, which at certain media query breakpoints turns into 2 columns, and later 1 column. This works like a charm. I tried testing my page on my phone, and everything seems to work, except for my grid-gaps, which is just ignored completely, and there is no gap. Then i tried testing my page in Edge, and here it seems that not a single grid property is working. Not even the basic layout of it. Any ideas why this is? I thought grid was fully supported at this point?
Edge has issues itself, not all devices universally support. Edge probably still working around. Honestly making 100% fool proof with CSS very difficult for complicated layouts in real life.
You can look at this jQuery for flawless grid on almost all devices in case your need is immediate for production purpose. jQuery projects has a basic advantage that users can report bug, test develop.
For the life of me I cannot seem to discover the root of this problem. The site in question is here: http://perfectashot.com/
The sections that are utilizing flex - the intro, the blue squares, the app, and the order section - aren't going into a column layout on mobile. I'm using autoprefixer to take care of my cross browser issues, and after searching some other topics I tried to set -webkit-box-orient: vertical; manually (this hasn't been pushed to the live site, sorry) Regardless of my efforts nothing seems to be taking effect.
If anyone has any ideas, or if I'm just an idiot and missing something glaring please let me know. Thanks.
Link in question: http://goo.gl/w5Vxu7
If you open this link on desktop computer, the vertical aligns are good.
However, on my cellphone, it is not:
This screenshot is taken from chrome://inspect with my Nexus 6 connected, it is exactly same with the appearance on my phone. You can see the first line is obviously dispositioned.
The small icons are Material Icons, related HTML and CSS are:
<div><i class="material-icons">today</i>2012-12-25</div>
<style>
html{font-size:15px;font-family:Microsoft Yahei}
div{font-size:1rem;line-height:1.5}
i.material-icons{line-height:1.4;vertical-align:bottom;font-size:inherit !important}
About that vertical-align:bottom, it looks a little weird not using vertical-align:middle, but I've always had vertical align issues with material icons, especially when accompanied with Chinese characters, which don't have baselines, and I've tried numerous different combinations of line-height,font-size,vertical-align,font-family for both the div and i.material-icons and decided this combination as shown above is the best.
I am quite obsessed with this issue and poured in lots of efforts trying to solve it. Until later I found out this only happens on my Nexus 6. On iPhones and other android phones there is no such problem. Even on my Nexus 6, if I use other browser instead of Chrome, there will be no problem; and even with Chrome, landscape view has no problem, the disposition only happens on portrait view of chrome on Nexus 6. I have only tested so far, but this still could be a potential problem for some mobile devices in some special environment, so it is still not an issue I can simply ignore. And this is where I can use some of this community's knowledge and experience - what could possibly be causing this behavioral discrepancy?
Vertical align MDI (MaterialDesignIcons)
The provided link currently returns a white screen, so I can't test your CSS.
The problem with the material-icons shouldn't be solved with a strange combination between height, line-height, padding and so on; explore new attributes. In my case, the following CSS solved the problem.
.material-icons{
display: inline-flex;
vertical-align: baseline; /* or middle? */
}
If the code above doesn't work, try different display properties.
Worth a try
My first thought was your use of rem, "older" browsers doesn't support it (can I use). It is still strange that it works in landscape, but try to define all measurements in a safe unit.
Another (problem)
If you want to support older browsers, you shouldn't write the icons in English, IE9 and below won't support it. Use the alternative solution instead (example below).
<i class="material-icons">today</i> /* do not use */
<i class="material-icons"></i> /* do use */
If you click on the icons and select "<> Icon font", you will be able to copy the html for older browsers.
If the information above don't help you, please fix the link (and tell me) and I will check if I can recreate the problem.