Home  >  Article  >  Web Front-end  >  ??一下 CSS ??器 可以?? 大于一定 尺寸的图片??_html/css_WEB-ITnose

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

WBOY
WBOYOriginal
2016-06-21 09:43:24878browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn