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
img {height:auto} is overriding height attribute in <img /> #1899
Comments
You can use the same trick with inline styles as the inline height attribute: |
I'm curious about the rationale for this declaration as well. Why use a style declaration for every image rather than setting height and width attributes in the markup where appropriate. |
Is there a reason for having img {height:auto} ? |
When combined with |
this is true in some browsers. yes you need it. |
however, |
Already fixed in #2779, >= 2.0.3 |
Some of us deal with an environment that has thousands of images. Applying that style to all images with inline styling is unreasonable. Sometimes the images are produced from content submitted through tinyMCE as well. |
I agree, if we wanted img {
max-width: 100%;
}
/* https://github.com/csswizardry/inuit.css/pull/111#issuecomment-12562366 */
img[width],
img[height] {
max-width: none;
} This solution doesn't resort to |
Prologue
A well-known trick for quicker page rendering and better user experience is to explicitly set the
height
attribute of animg
(i.e.<img height="30" src="..." />
). This will avoid nasty "jumps" while the page is rendering if the height of an image (being downloaded) is known.Problem is: afaik, the following rule makes it impossible to take advantage of that technique.
Weird as it sounds, It will override the inline attribute value.
I couldn't find any value for
height
(the CSS property, not theimg
property) to "undo" this.I'm not sure the rationale for this particular property in the above rule, so I wonder if someone could shed some light, and a workaround/fix for this issue.
The text was updated successfully, but these errors were encountered: