I have an MVC4 project which has the following structure:
/Content/css/sprites/topbar.css
/Content/images/topbar.png
In the css file I am trying to reference the image by using:
background: url('../../images/topbar.png')
But the image is not displayed. If I change it so that the image is located in:
/Content/css/sprites/topbar.png
And change the css to be:
background: url('content/css/sprites/topbar.png')
it works, but this breaks my project structure.
Any ideas?
EDIT
I didn't mention something else as I didn't think it was relevant, however it appears to affect this!
I use @System.Web.Optimization.Styles.Render("~/MainStyles")
to bundle and minify the css, but if I take that step out, then it works as I would expect. How would I get it all to work with my project structure and using the bundling?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…