简体   繁体   English

如何从单个图像忽略img类

[英]How to ignore img class from a single image

I am using CSS to make sure that images are not bigger than there parent to ensure responsiveness and that everything looks good. 我正在使用CSS来确保图像不比那里的父母大,以确保响应速度,并且一切看起来都不错。

but I just added a image zoom. 但我刚刚添加了图像缩放。 but its showing the hole image inside the zoom area instead of just a bugger image 但它显示的是缩放区域内的孔图像,而不仅仅是错误图像

i know if if remove the max-width:100% in the img tag it works well but the rest of the site does not 我知道是否如果将img标签中的max-width:100%删除,则效果很好,但该网站的其余部分却没有

my css 我的CSS

img {
  /* Responsive images (ensure images don't scale beyond their parents) */

   max-width: 100%;
  /* Part 1: Set a maxium relative to the parent */

  width: auto\9;
  /* IE7-8 need help adjusting responsive images */

  height: auto;
  /* Part 2: Scale the height according to the width, otherwise you get stretching */

  vertical-align: middle;
  border: 0;
  -ms-interpolation-mode: bicubic;
}

i just want to ignore this when i called it from a particular image or JavaScript 当我从特定图像或JavaScript调用它时,我只是想忽略它

You should simply be able to do this to override it: 您应该可以简单地做到这一点来覆盖它:

#IDofSomeImage{
    max-width: none;
}

http://jsfiddle.net/Ahxpg/ http://jsfiddle.net/Ahxpg/

This works due to css specificity rules. 由于CSS特殊性规则,此方法有效。 As long as this rule is more specific than the other, it will take precedence. 只要该规则比其他规则更具体,它将优先。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM