ie8 inline-blockとmax-widthで消えた
floatとmax-widthでも消えるらしい・・・
参考
http://creatorclip.info/2013/09/ie8-img-max-width-bug/
seen from Vietnam
seen from United States

seen from United States

seen from Malaysia

seen from Türkiye
seen from Romania
seen from China

seen from Türkiye
seen from United States

seen from Spain
seen from South Korea
seen from United States

seen from T1

seen from Maldives
seen from China
seen from South Korea

seen from Singapore

seen from Switzerland

seen from United States

seen from United States
ie8 inline-blockとmax-widthで消えた
floatとmax-widthでも消えるらしい・・・
参考
http://creatorclip.info/2013/09/ie8-img-max-width-bug/
min-width, min-height, max-width, max-height
Bu özellik blok level ve yerine konulabilir element içerik alanının azami genişliğiin tanımlar. max-width margin, padding ve kenarlıkları içermez.
width değeri daha geniş olsa bile max-width değerini aşamaz. Bu ilginç bir kuraldır. Ancak min-width değeri eğer max-width değerinden büyükse bu değeri uygular, yani min-width değeri baskındır.
min-width ve min-height element genişliğinin belirli bir aralıkta olması için beraber kullanılır.
max-width ve width ilişkisi
max-width ve width aynı elemente ayı değerlerde uygulanmamalıdır, birisi diğerine baskın olur. Örneğin width değeri 150px ve max-width değeri 60px olarak atanmışsa
button{ background-color:#069; float:left; min-width:200px; width:auto !important; width:200px; white-space: nowrap; }
min-width için - http://friendlybit.com/css/min-width-for-ie-revisited/
http://perishablepress.com/press/2007/01/16/maximum-and-minimum-height-and-width-in-internet-explorer/#comment-29907
http://www.cssplay.co.uk/boxes/minwidth.html
http://css.flepstudio.org/en/css-tips/min-width-ie6.html
http://www.gunlaug.no/contents/wd_additions_14.html
Fluid images (max-width: 100%) re-sizing to parent div
I was building a site recently that was at first glance, the easiest thing in the world. There was a menu on the left, and an image on the right. The thing is that everything had to be perfectly positioned.
So I needed an image with max-width: 100% inside a div that was positioned absolutely (with spacing around it) and it also needed to respect the browser's boundaries.
I was having the hardest time getting the image to respect the parent div and the browser's height. Until I realized that I could also add a max-height to the image.
So simple.
Here's the code.
#main { // respect the boundaries on the right position: absolute; left: 300px; right: 60px; bottom: 0; top: 0; } #main ul li { // wrap to parent and respect the boundaries at the top and bottom bottom: 60px; position: absolute; top: 100px; right:0; left:0; } #main img { // wrap to parent li tag and respect all boundaries width: auto !important; width: 100%; max-width: 100%; max-height: 100%; }
To view it in action, here's the jsfiddle for it: http://jsfiddle.net/sikodelika/Ev6Vj/
PS: make sure to resize the js fiddle window a lot
自己在写排列图片然后让图片居中显示的CSS的时候,遇到的问题,怎么也找不到问题的所在。思来想去,也还是没有办法,想要放弃换一种实现方式的时候看到了这篇文章,于是问题解决了。感谢作者.原文如下:
I'm setting up a small photo-album-type thing, where I use PHP to set up a list of images for visitors to click through. That's all simple enough. However, I'm having a weird bug in IE8. Because the images can all be of different sizes (nothing I can do about that... outside my control), I use a CSS trick to get them all centered both vertically and horizontally, and scaled down to a proper size. Basically, I put the image tag inside two div tags, the first one to align the divs horizontally, and the second to align the image both horizontally and vertically. Then the image tag scales down images that are to large using the max-height and max-width styles. That all looks like this: (Added the borders to see the exact position of the divs)
Expand|Select|Wrap|Line Numbers
#GalleryPreview {
width : 400px;
height : 290px;
margin : 0 auto;
border : 1px solid #0000ff; /* For debuging */
}
#GalleryPreview_VerticalFix {
width: 400px;
height : 290px;
display : table-cell;
vertical-align : middle;
text-align : center;
border : 1px solid #00ff00; /* For debuging */
}
#GalleryPreview img {
max-width : 400px;
max-height : 290px;
}
Expand|Select|Wrap|Line Numbers
<div id="GalleryPreview">
<div id="GalleryPreview_VerticalFix">
<img src="PHP Generated" alt="Image Preview" />
</div>
</div>
This works in all the standard supporting browsers. Everything is scaled down and centered perfectly. IE7 fails to do the vertical alignment, but that's good enough for IE. IE8, on the other hand, does something much worse. For images that scale down to less then the set max-width, this works perfectly to. It centers them both vertically and horizontally. But when images scale down to exactly the max-width, the table-cell appears to forget it was scaled down, expanding itself until it reaches the width of the original image size. But it still centers the image correctly... just way out of place. (See the images I attached. One is from Firefox, the other IE8) I'm thinking this must be a bug in IE (shocking, I know). I mean, the image is scaled, but it's original width is being used by it's parent, which is not the case with the height. Either this was the intended behavior and the height is bugged, or it's not and the width is. In any case, does anybody know a workaround, or another method to center the images? I'll keep looking, hopefully find something before I just drop IE support altogether :)
Lazy man's responsive web design
The Boston Globe recently raised the bar for responsive web design.
Please allow me to lower it.
For our playbook, I wanted to provide a pleasant reading experience for desktop and mobile web browsers. However, I'm lazy.
My answer to "what's the simplest thing that could possibly work?" was a single-column layout with a maximum width that would also fit mobile devices:
margin: 0 auto; max-width: 480px;
That makes the User experience section look like this on a desktop...
... and like this on an iPhone...
No media queries or other additional resizing tricks except for messing with the viewport a little and hiding the browser bar when possible:
It also means fewer conditional statements, which we aim to eliminate.
max-width isn't supported in IE6 but we don't support IE6.
Responsive web design is already very elegant in its simplicity. My thought is that for use cases like landing pages and content sites, it can be even simpler using a thin, vertical one-column layout.
I've heard landing pages convert better using a vertical, single-column layout. The premise is anything that distracts the user, including navigational elements and sidebars, will hurt conversion.
For the playbook, the average time on the site is 4:40. So, I'm feeling pretty good that the layout is working well to focus readers on the content.
My guess is other content sites like McSweeney's Internet Tendency do similarly well keeping its readers engaged on their 400px-wide desktop version:
With the addition of one line of code...
<meta name="viewport" content="width=device-width">
...they could make their mobile web version immediately readable without zooming instead of presenting a garish request to download software for "optimized" reading:
It's so easy, even a lazy man can do it.
Written by Dan Croak.
Min / Max width (IE included)
#content { width: expression(document.body.clientWidth < 762? "760px" : document.body.clientWidth > 1242? "1240px" : "auto"); min-width: 760px; max-width: 1240px; }