0
I have a simple HTML fragment:
<div>
<img src="http://www.placehold.it/200x200">
<p>Lorem ipsum da dee da herp de derp I like coffee coffee coffee</p>
</div>
My CSS:
div {max-width: webkit-min-content; max-width: -moz-min-content;}
img {max-width: 100%}
Fiddle: http://jsfiddle.net/vs2zxc8c/1/
See how it looks in Firefox and shrink the window screen. This is the behavior I want: When there is space available, the image has its normal size and the text will go under the image. When the image overflows, I want to shrink it. This works on Firefox.
However, the Webkit version does not seem to work. Applying max-width:100%
image causes the image to shrink to the size of the longest paragraph word.
There is a fix for this in -Webkit browsers, or this is a bug?
You can provide a complete example so that I understand?
– Nick Manning
Yes, I can, but if you make the modifications I suggested in the
fiddle
from your example you can see @Nickmanning– Cold
I did, but the number is bigger than the picture now.
– Nick Manning
Yes, because in my example I put 100%, you can put the necessary percentage, or test now with the 200px and it will work in a good.
– Cold
I need the number to be the same width as the image, but I don’t know the size of the image will be.
– Nick Manning
Um, well, I didn’t get that idea in the question, sorry. Just to confirm, when you say "number," you mean the descriptive text that’s under the right image?
– Cold
Let’s go continue this discussão in chat.
– Cold
number and "<p>Lorem ipsum da dee da herp de Derp I like coffee coffee coffee</p>"
– Nick Manning
I’m at work, so I can’t talk. Maybe later. Thanks
– Nick Manning