3

I am having issues using Stylish to skin a site but the image values given are not all the same case. I will get some images with Cattle.GIF, Cattle.gif or cattle.GIF. Right now, I have it working for one set of the images but the others will not work.

img[src*="cattle"] {
    height: 00 !important;
    width: 1 !important;
    /* these numbers match the new image's dimensions */

    padding-left: 41px !important;
    padding-top: 35px !important;
    background: url(https://s3-us-west-1.amazonaws.com/resonantriseimages/resources/CattleIcon.png) no-repeat !important;
}

Above will only work if the word is all lower case. I am trying to make it so it doesn't care if it is capital or lowercase.

Ryahn
  • 537
  • 7
  • 24
  • 1
    any chance you could use javascript? It is much easier that way. – karthikr Dec 21 '15 at 00:19
  • When it's supported, you should be able to use `img[src*="cattle" i]`.. http://www.w3.org/TR/selectors4/#attribute-case – Josh Crozier Dec 21 '15 at 00:21
  • @t3dodson that question relates to using jQuery which the OP hasn't specified. I guess he's looking for a CSS only solution, of which there isn't really one. – Steve Dec 21 '15 at 00:21
  • I dont know if Stylish support javascript. I think I would have to use tampermonkey or something of the like. – Ryahn Dec 21 '15 at 00:21
  • There's no easy way—you will either have to rely on JS to convert the attributes to lowercase, or manually go through all possible permutations in CSS alone (which is unnecessarily tedious). – Terry Dec 21 '15 at 00:21
  • @Terry: I may have to do that but trying to keep the code clean the short. – Ryahn Dec 21 '15 at 00:22
  • @JoshCrozier: It looks like Stylish doesnt support the i – Ryahn Dec 21 '15 at 00:22
  • 1
    @Ryahn Then yes, you will have to do the JS way. – Terry Dec 21 '15 at 00:23
  • @Terry: Thanks, looks like I will have to learn a little JS. Thanks everyone – Ryahn Dec 21 '15 at 00:24

0 Answers0