0

Most of the many related issues seem to be with paths, but externally linking and not using a stylesheet it still won't work. Using an image in the same folder as the code also doesn't work. The CSS validates on codebeautify.

.logo { background: url("http://findicons.com/files/icons/1620/crystal_project/128/keditbookmarks.png") left center no-repeat; background-size: 50% 50%; width: 100px; }
<div class="logo">some text</div>
<div>random stuff before <span class="logo">star</span><br>
    empty span <span class="logo"> &nbsp;&nbsp;&nbsp;</span>after<BR>
    <img src="http://findicons.com/files/icons/1620/crystal_project/128/keditbookmarks.png"/></div>

[jsfiddle](http://jsfiddle.net/Mousey/uhcpcy7k/) 
Mousey
  • 1,855
  • 19
  • 34
  • I disagree that it's a duplicate question, the answer is relevant to more than one question – Mousey Oct 11 '15 at 20:18

1 Answers1

1

You have a non-UTF-8 space or may be a &nbsp; after the background:. Replace it with correct space.

Please see the below output of encodeURIComponent using Chrome:

The first one is my text. The second one being yours from the fiddle.

.logo {
  background: url("http://findicons.com/files/icons/1620/crystal_project/128/keditbookmarks.png") left center no-repeat;
  background-size: 50% 50%;
  width: 100px;
  height: 100px;
}
<div class="logo">some text</div>
<div>random stuff before <span class="logo">star</span>
  <br>empty span <span class="logo"> &nbsp;&nbsp;&nbsp;</span>after
  <BR>
  <img src="http://findicons.com/files/icons/1620/crystal_project/128/keditbookmarks.png" />
</div>

Fiddle: http://jsfiddle.net/z9060o2j/

Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252
  • that's great - is there a way to find these without inspecting the DOM? Anything than can be searched for in a text editor or other programming tool or validation? I wonder if this is why codebeautify validated it but w3.org gave odd errors. For an unknown reason \0a and variants do not work inside `:before {content :` css in my code, but in the css in my example the space wasn't needed so I just deleted it. – Mousey Oct 11 '15 at 20:21