How to escape quotes in inline styles?
First off, why?
You should be using ()
instead of '{}'
This way is best:
<div style="background: url('http://my-url.com/img.jpg')"></div>
This way is fine:
<div style="background: url("http://my-url.com/img.jpg")"></div>
This also works:
<div style="background: url(http://my-url.com/img.jpg)"></div>
This doesn't work:
<div style="background: url(\"http://my-url.com/img.jpg\")"></div>
Note: Remove the space after url
.