0

This is not a duplicate question because I am trying to override css of a external image with a href value.

I have this external image put all over a wordpress website but I cannot figure out a way to change image width with css. The problem is I cannot alter the code here.The "wpd_wrapper" class is used on other places on the website as well.

I want to make the image width 110px

<div class="wpb_wrapper">
    <a href="https://geo.itunes.apple.com/us/album/nuh-strange-face-single/id392890270?at=11lSfu&amp;mt=1&amp;app=music" style="display:inline-block;overflow:hidden;background:url(http://linkmaker.itunes.apple.com/images/badges/en-us/badge_music-lrg.svg) no-repeat;width:162px;height:40px;"></a>
</div>

I have tried selecting the image with [attribute] like below. But it is not working. What Am I doing wrong here?

img[url*="badge_music-lrg.svg"] {
    width: 110px !important;
}
MaxE
  • 57
  • 6

2 Answers2

1

It isn't an <img> so the img type selector won't match.

It doesn't have a url attribute, so your attribute selector which looks for url=something won't match.

Target something that is there. It is an <a> element and it has a style attribute.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Thank you Quentin and @VikingBlooded Here I matched an a element with style attribute that has 'badge_music-lrg.svg' anywhere in it. – MaxE May 13 '16 at 07:45
  • a[style*='badge_music-lrg.svg'] { width: 110px !important; } – MaxE May 13 '16 at 07:51
0

I followed @Quentin's directions and came up with the answer

a[style*='badge_music-lrg.svg'] {
width: 110px !important;
}
MaxE
  • 57
  • 6