>  기사  >  웹 프론트엔드  >  ??一下 CSS ??器 可以?? 大于一定 尺寸的图片??_html/css_WEB-ITnose

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

WBOY
WBOY원래의
2016-06-21 09:43:24875검색

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?做了。。。

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.