Answer the question
In order to leave comments, you need to log in
Why is the image not paying attention to the max-width?
The image lies in a block whose width is set in%.
I put a picture width:100%
and everything is fine.
And if I put a clear width in place, max-width:100%
then the picture simply does not pay attention - it stretches as it wants, according to its true width.
Why?
jsfiddle.net/2mrn5epp/3
In FF I check, if anything. Everything is fine in chrome.
Answer the question
In order to leave comments, you need to log in
This is a bug https://bugzilla.mozilla.org/show_bug.cgi?id=975632
Add
.wrapper {
....
table-layout: fixed;
width: 100%;
}
img{
max-width: 100%;
}
.two {
....
width: 150px;
}
.main {
.....
width: 100%;
max-width: 200px;
}
Butter oil... width - width, max-width - maximum possible width. It's not clear what you want...
If the image should fit the size of the block, width:100% is enough.
If we are talking about the size of the picture without taking into account the block, it is written here .
If you want to limit the image inside the block to a certain size, then the max-width value should not be a percentage. Specify in px, in em, cm, mm or something even more specific.
Because is an inline element. Those. its percentage width is taken from its true width and only affects the width of the element, not the width of the container block.
If you want responsive design, forget the img tag. Use the css background property.
example
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question