Images in css files in mvc 4

I am using mvc4 to develop a website.I have home page.I included my css file like

@Styles.Render("~/Content/css/style2.css")

Now its not implemented on my page.My css file has paths to images etc.Do i need to change those paths also?

.input-menu > ul > li {
float:left;
list-style:none outside none;
cursor:url(../images/magnifyer.png),url(myBall.cur),auto;
margin:0 5px;
}

DO i need to change ../images/magnifyer.png inside my css file also?

By your question i guess you are using Bundles in ur app. If you do its not the way to use Bundles

bundles.Add(new StyleBundle("~/Bundles/Content/css").Include("
~/Content/css/style2.css"
"));

and call it as it in View or Layout or whatever
@Styles.Render("~/Bundles/Content/css")

Vivekh Fedx

y your question i guess you are using Bundles in ur app

I am not using bundles..I am using single by single like @Styles.Render("~/Content/css/style2.css")

Only question that should i change path in css files?

Just keep the image paths relative to the path used to reference the css file and you will be all set.

As long as you are referencing an external CSS file (like you are using the style2.css file), you should have no problem referencing the images using a relative path (as you currently are). If you were to reference your particular image
style within a <style> block, then the image reference would be relative to the page that contains the <style> block and would cause issues, but since you are using an external CSS file, you should be just fine.

Leave a Reply