Heim  >  Artikel  >  Web-Frontend  >  ??一下 CSS ??器 可以?? 大于一定 尺寸的图片??_html/css_WEB-ITnose

??一下 CSS ??器 可以?? 大于一定 尺寸的图片??_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-21 09:43:24875Durchsuche

CSS 图片

 
不知道用CSS能不能实现 小图片一种样式,大点的图片实现一种样式。

注意 用的是??一下 CSS ??器 可以?? 大于一定 尺寸的图片??_html/css_WEB-ITnose标签写CSS。

回复讨论(解决方案)

这个问题太泛泛了吧,怎么区分大小图片呢?
下面假设小图以_s结尾。

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>    <title></title>    <style type="text/css">        img[src$='_s.jpg'] {            border:1px solid #ccc;        }    </style></head><body><img  src="http://img4.cache.netease.com/cnews/2013/5/14/20130514124343269bf.jpg" / alt="??一下 CSS ??器 可以?? 大于一定 尺寸的图片??_html/css_WEB-ITnose" ><img  src="http://img4.cache.netease.com/cnews/2013/5/14/20130514124343269bf_s.jpg"  / alt="??一下 CSS ??器 可以?? 大于一定 尺寸的图片??_html/css_WEB-ITnose" ></body></html>

不行,不过可以用这种方法遍历
$("img").each(function(){
    if($(this).width>200){
        $(this).addClass("big");
    }else{
        ....
    }

})
大约如此.

if($(this).width ()

不行,不过可以用这种方法遍历
$("img").each(function(){
    if($(this).width>200){
        $(this).addClass("big");
    }else{
        ....
    }

})
大约如此.

if($(this).width ()

这个问题太泛泛了吧,怎么区分大小图片呢?
下面假设小图以_s结尾。

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>    <title></title>    <style type="text/css">        img[src$='_s.jpg'] {            border:1px solid #ccc;        }    </style></head><body><img  src="http://img4.cache.netease.com/cnews/2013/5/14/20130514124343269bf.jpg" / alt="??一下 CSS ??器 可以?? 大于一定 尺寸的图片??_html/css_WEB-ITnose" ><img  src="http://img4.cache.netease.com/cnews/2013/5/14/20130514124343269bf_s.jpg"  / alt="??一下 CSS ??器 可以?? 大于一定 尺寸的图片??_html/css_WEB-ITnose" ></body></html>



??  看?只能同js?做了。。。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn