隐藏特定大小的图片,由CSS? [英] Hide image of specific size, by CSS?

查看:124
本文介绍了隐藏特定大小的图片,由CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先感谢您的帮助!

我有一个RSS,我想在我的页面上发布此RSS的内容,但RSS是从WordPress和它包含要评论的按钮的图像。

I have an RSS, I want to post the content of this RSS on my page, but the RSS is from WordPress and it contains an image of a button to comment.

问题1:如果我隐藏每个< img>

Problem 1: if I hide every <img> from the RSS, I also hide images posted on the article from the blog.

问题2:注释按钮< img> URL是连续的,所以即使我可以隐藏wordpress.com/comments/ ... 12,下一个按钮< img> url是wordpress .com / comments / ... 13等:(

Problem 2: the comment button <img> URL is sequential, so even if I could hide "wordpress.com/comments/ ... 12", the next button <img> url is "wordpress.com/comments/ ... 13" and so on :(

图片的HTML:

<img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mulleralc.wordpress.com/35/">

有一种方法可以识别评论按钮图片:它是72px x 16px。因此,我需要隐藏我的页面上的每张图片都是72(宽)x 16(高)。有没有办法在CSS或JavaScript中这样做?

There is one way to identify the comment button image: it’s 72px by 16px. So, I need to hide every picture on my page that is 72 (width) x 16 (height). Is there a way to do this in CSS or JavaScript?

img[src~="http://...url..."] {display: none;}    

也许有类似的东西:

img[height="16"] {display: none;}


推荐答案


注释按钮URL是顺序的,所以即使我可以隐藏wordpress.com/commentbutton/12,下一个按钮url是wordpress.com / commentbutton / 13等等:(

the comment button URL is sequential, so even if I could hide "wordpress.com/commentbutton/12", the next button url is "wordpress.com/commentbutton/13" and so on :(

CSS实际上可以帮助你。属性选择器可以选择包含值的属性。所以,这:

CSS can actually help out here. The attribute selector can select attributes which contain a value. So, this:

img[src*="feeds.wordpress.com/1.0/comments"] {display: none;}

应该这样做。

这篇关于隐藏特定大小的图片,由CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆