Images not properly resizing after being downloaded; they stay at 10x10px - html

I have an odd scenario with my CSS, happening in all browsers:
Sometimes, when a new image appears, it displays using the min-width/min-height size specified in my CSS. If I merely resize the browser (drag a corner) the problem goes away and the image properly shows up at the full, correct resolution. In fact, this does not even happen every time. It only happens about 5-10% of the time, when an image is first seen. Eg, if I clear the cache on my browser and then reload, the problem becomes more prevalent.
Here's a picture of the Chrome elements panel, which shows that the min width/height (10px) is being applied instead of the "natural" resolution:
And here's what it actually looks like on the screen:
The border of the image is being applied via my CSS...
.streamifiedPostImageContainer {
margin-top: 5px;
overflow: hidden;
width: 100%;
}
.streamifiedPostImage {
float: left;
margin-right: 8px;
max-width: 100%;
}
.streamifiedPostImage img {
border: 3px solid #FFF;
max-width: 100%;
max-height: 100%;
min-width: 10px;
min-height: 10px;
box-shadow: 0px 1px 8px 1px rgba(0, 0, 0, .3);
}
I've used the elements panel to inspect all the styles. The elements panel shows the "computed" size at 10x10px, yet all of the "Styles" properly match my CSS (above), with no indication why it would be using the min width/height instead of the (proper) image width/height.
Again, the strangest thing is that this fixes itself by merely dragging a corner on the browser or reloading the page. It seems that there is some sort of race condition between the image being cached and the CSS being applied, because it only happens about 5-10% of the time, but it DOES happen on all browsers.

Related

Problem with usable screen height in landscape - iOs Safari

need some help with a website I'm working on.
Portrait mode on Android looks like this:
Now, landscape, no css change:
No problem whatsoever. Follow me to the next screenshot illustrating what happens on iOs Safari/Chrome in portrait mode. Everything fine:
Landscape mode goes to "fullscreen" since it's an SE so I figured the screen, being quite small, goes full screen and that still looks fine.
I can scroll through the content no problem. However, when I click a link to go to another page this happens:
The behavior of the page is quite simple: the scrollable content is inside a div which is the rounded one which mustn't move during scrolling. What happens is that the rounded div is set to be 100% height of the screen and when top and bottom navbars appear on iOs, the rounded div won't change its height to adapt to the usable screen part.
body css is as following:
body {
margin: 0;
height: 100%;
overflow: hidden;
-webkit-text-size-adjust: 100%; }
while rounded corners div is managed like this:
.rcorners {
position: absolute;
margin-top:15px;
margin-bottom:15px;
margin-left:15px;
margin-right:15px;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100%-20px;
height: 100%-20px;
background-color: white;
border-radius: 10px;
-moz-box-shadow: 0 0 6px 2px #C0C0C0;
-webkit-box-shadow: 0 0 6px 2px #C0C0C0;
box-shadow: 0 0 6px 2px #C0C0C0;
overflow:hidden; }
Any ideas on how to make the height right everytime the usable screen size changes?
Thank you
So sadly iOS has been notorious for this type of stuff for what seems years. First it was the top address bar, and now it is the browser menu. So you have a couple options. YOu can set a media query for landscape and shorten the height of that container and just have it scroll if you need. Could probably drop font-size too. Or there are a couple options in this article that might help.
You could also try 100vh instead as well. As that will make it the full height of the available viewport which I have seen at times act the way I needed it to vs 100% height.
https://www.eventbrite.com/engineering/mobile-safari-why/

Chrome inserts scrollbar sometimes when using borders and zooming, when there is no overflow

I'm making a responsive website that has pages with several nested <div>s with various 1px borders. I have overflow set to auto in case some unexpected element exceeds the screen size.
In Firefox everything looks fine.
But in Google Chrome, sometimes grey scrollbars (unscrollable) appear even when there is no overflow content. Sometimes it's X or Y or both, depending on the zoom level.
The problem disappears when turning off the 1px border.
I've done further testing and the problem appears on Windows 7 and 8.1, but not 10. The behavior on my computers are opposite for Windows 7 and 8.1. When zoom is 100% Win 8.1 shows scrollbars, while Win 7 does not. When zoom is 90% or 110% Win 8.1 does not show scrollbars, while Win 7 does show.
If I wrap the <div> with border with an outer <div> with no styling, the scrollbars disappear most of the time except for 75% zoom.
Using box-sizing:border-box; did not help.
Is there a simple solution I can use to fix this without having to change things in the body or breaking the styling of the other various pages on the site?
Here is a jsfiddle test which is fine on Firefox but shows X scrollbar in Chrome at 100% zoom for me:
https://jsfiddle.net/tsr1w630/0/
html {
margin: 0;
padding: 0
}
body {
background-color: #fff;
color: #000;
font-family: Arial, Helvetica, sans-serif;
margin: 0;
padding: 3px;
overflow: auto;
}
.box_with_border {
display: block;
border: 1px solid #CCC;
overflow: auto;
padding: 3px
}
<div class="box_with_border">
asdf1234
</div>
I attached a screenshot here:

iFrame border-radius displays visual gaps

When adding a border-radius on an iFrame's parent div, the border doesn't perfectly fit the iFrame, even when they are assigned the same width and height values.
I've added arrows pointing to the visual gaps in the resulting image below. Screenshot is from the latest version of Chrome (March, 2016).
HTML Code:
<div class="mapFrame">
<iFrame class="googleMap" src="http://maps.google.co.uk/maps?q=sanfrancisco&output=embed" width="500" height="400"></iFrame>
</div>
CSS Code:
.mapFrame
{
border-style: solid;
border-width: 6px;
border-color: #ffffff;
box-shadow: 0px 0px 20px #000000;
margin: auto;
border-radius: 80px;
overflow: hidden;
width: 500px;
height; 400px;
position: relative;
}
Result:
Have you tried .mapFrame iframe {border: none}? From my computer (also latest chrome), it appears to be the default iframe border. You might also consider making the iframe display:block as inline elements tend to have line height and letter spacing that throws off pixel exact rendering.
Border radius isn't well supported or consistent yet. If you want the desired effect, try using DIV's around the element and use graphics instead, with an overflow of hidden in your CSS. You might want to look into the sliding doors technique if you're iframe varies in height.
http://www.alistapart.com/articles/slidingdoors/
Hope this helps.
Good luck!

Why CSS Background position changes on sprite height change?

Something interesting happens in my website. It is in active development and I keep adding and adding stuff to the website's sprite PNG file. Sometimes I add so many icons and blocks that I NEED to change the height of the image, but when I do this, some (NOT ALL!) elements appear on different locations.
For example I have a PNG image with size 900x900 pixels. I mapped the CSS styles to the proper coordinates, they I added 200 pixels of transparent space at the bottom of the image and some styles report different positions :< breaking stuff around the website. So each time I increase the sprite file, I have to open various CSS files and add X pixels (the amount of height I've added). I even added a 1px baseline on the top of the sprite so that I would be certain that I am not changing any positions but just the height.
I read the specification even in the RFCs and the coordinate system start is at x=0,y=0 which is the top left corner of the image. It doesn't make sense to me :(
UPDATE: Some of the containers that give me bugs are made with positive coordinates rather than negative. I still can't explain it to myself, why stuff like that happens.
UPDATE: So the sprite is located at this URL http://lucho.hoolwars.com/img/sprites.png
and here are few styles that change coordinates if the height of the sprite changes
.job-summary {
width: 330px;
height: 45px;
background: transparent url(/img/sprites.png) -15px 435px;
cursor: default;
}
.popup-title {
background: url('../img/sprites.png') -425px -1077px transparent;
width: 275px;
color: black;
font-weight: normal;
}
.popup-close {
position: absolute;
background: url('../img/sprites.png') -771px -972px transparent;
right: -9px;
top: -22px;
width: 38px;
height: 38px;
z-index: 2;
cursor: pointer;
}
Each time I change the height of "sprites.png" those coordinates are no longer valid :|
I think I know whats going on. Hard to explain - but I'll give it a shot.
I believe you have configured some of your sprite images based on the repeating background, because you are not using no-repeat. Every time you add more images to the sprite any icons that were configured on a repeated image will shift.
You will need to:
1) Add no-repeat to your background (any icons that were using a repeated image will probably now be blank)
2) Reconfigure all your classes to use negative values (always use negative values for your image sprites)
I would suggest you setup your sprites similar to this:
CSS
.sprite-map {
background: url(sprites.png) no-repeat;
}
.job-summary {
background-position: -80px 0;
width: 100px;
height: 80px;
}
.popup-title {
background-position: -15px -100px;
width: 200px;
height: 100px;
}
.popup-close {
background-position: -15px -472px;
width: 50px;
height: 50px;
}
HTML
<div class="job-summary sprite-map"></div>
<div class="popup-title sprite-map"></div>
<div class="popup-close sprite-map"></div>
That way you only need to specify the URL to the sprite once. Now when you add images to the bottom or the right of the sprite - nothing else will be affected.
Also if you're familiar with Sass - Compass makes image sprites incredibly easy. It might be worth taking a look at if you're interested: http://compass-style.org/help/tutorials/spriting/
Hope this helps!

Background image does not show on iPhone/iPad

There is a background image on our Magento web site that expands as needed due to the amount of content. It works fine on PCs and (hopefully Macs). But on any iOS device, the white background is not shown.
I have included two screenshots - one of how it looks in a regular PC browser and one showing how it looks on an iPhone. (see next post for the screenshots)
Here is our site: http://tinyurl.com/arfpf7g
Here is a link directly to the image that is not showing up on iOS devices: http://tinyurl.com/bcovmvg
Thanks!!
The problem is that iOS has a limit on the maximum dimensions of images it can load. From memory, it's 3 to 5 megapixels, depending on the device. For reference, Your image is 9.78mp (978 x 10000).
Your background image has absolutely no reason to be that big. It's 171kb and it's repeatable after about 10px. Cut out the top and it could be 10px high and you could achieve the same affect using background-repeat: repeat-y instead. Then simply apply the top of the background to another element.
Alternatively, that background image could be replicated in css using a box-shadow and a dashed border.
CSS:
.outer {
margin: 20px;
width: 200px;
box-shadow: 0 0 10px 4px rgba(0, 0, 0, 0.3);
padding: 10px;
}
.inner {
height: 200px;
border: 1px dashed #bde432;
}
HTML:
<div class="outer">
<div class="inner"></div>
</div>
Demo: http://jsfiddle.net/WUpEF/