New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
developers.google.com - layout is messed up #1461
Comments
Simplified demo: http://codepen.io/malyw/pen/zGmzbq?editors=110 |
@malyw Instead of Notice how the image and video remains responsive when you resize the viewport below 300px. |
When the viewport is img, object, video {
width: 100%;
display: block;
margin-top: 26px;
margin-bottom: 26px;
}
.update-container img {
width:auto;
max-width:100%;
display:inline-block;
margin-top:0;
margin-bottom:0
} but when the viewport is for example 768px, we hit! img, object, video {
width: 100%;
display: block;
margin-top: 26px;
margin-bottom: 26px;
}
.update-container img {
width:auto;
max-width:100%;
display:inline-block;
margin-top:0;
margin-bottom:0
}
@media only screen and (min-width:620px) {
…
img, object, video {
width: auto;
max-width: 100%;
}
} In that case the If instead the site owners are doing: .update-container img {
display: inline-block;
margin-top: 0px;
margin-bottom: 0px;
}
@media only screen and (min-width:620px) {
img, object, video {
max-width: 100%;
}
} I need to check if it creates issues for smaller viewports. |
@miketaylr do you know anyone working on developers.google.com ? |
@karlcow There’s a discussion about this with Paul Bakaus on Twitter: https://twitter.com/pbakaus/status/624709026534682624. I think he can take care of this. |
@pbakaus see above :) Thanks @simevidas |
I put in a very ugly temporary fix for Firefox (involving -moz-calc!), because I couldn't figure out a sensible fix. width: 100% doesn't work because smaller images will be blown up to 100%. max-width on the container only works partially, as 100% seems to take the width of the body/viewport in Firefox. So I had to use calc to appropriate it. This is a browser level issue I believe, and should be fixed in Firefox. |
Thanks @pbakaus Let's see if we can improve this a bit There is no issue with smaller viewports on both blink and gecko When I remove the .update-container img {
/* width: auto;
max-width: 100%; */
display: inline-block;
margin-top: 0;
margin-bottom: 0
} I have the correct behavior in Blink for small viewport and big viewport Then I added @media only screen and (min-width:620px) {
img, object, video {
max-width: 100%;
width: 100%;
}
} And it seems to be working both with Blink and Gecko (In this page). @pbakaus is there a page where this suggestion blows up things? |
there are a quite a few pages. The thing is, said technique only works because you're using width: 100% (in the earlier example as well, as width: 100% comes from another CSS class then). But I don't want width: 100%. I want to be able to support images that are smaller than the default viewport. |
Here's a page for you to test against: https://developers.google.com/web/fundamentals/layouts/principles/menus-short In this other part of the site, my additional styles from the Updates section aren't applied. In this case, the following logic controls the image: Big viewport:
Small viewport:
But here's the thing – that's crap. Try resizing that page until a certain level and the image gets blown up bigger than its actual size. Thus, that's simply not a solution (and is a bug on this page, in general). |
(First of all I agree that there is a different interpretation in between Gecko/Blink 😄 I keep adding stuff to the bug which is happening in different circumstances. It's basically about shrink to fit and intrinsic width. The two rendering engines operate differently, but not sure if the behavior is specified in a spec.) The issue on that page. I solved it with |
@dholbert another one with the silly |
URL: https://developers.google.com/web/updates/2015/07/23/devtools-digest-film-strip-and-a-new-home-for-throttling
Browser / Version: Firefox 39.0
Operating System: Windows 10 (Insider preview)
Problem type: Layout is messed up
Steps to Reproduce
Expected Behavior:
The embedded elements (images, videos, iframes) should respect their container’s width (which is 714px).
Actual Behavior:
Instead, they appear too large and make the entire layout too wide, overflowing the viewport.
The text was updated successfully, but these errors were encountered: