I\'m new in asp.net. And I am having trouble setting my background image. Here\'s the master page source:
<%@ Master Language=\"C#\" AutoEventWireup=\"true\"
This worked for me :
background-image: url(<%=ResolveClientUrl("~/images/background.jpg")%>);
Add master page, then link css script and paste the link of CSS using drag and drop method
This largely depends on where your css file is located. If it is located in the same folder where the 'image' folder is located, then this looks correct. However, if you css file is in a different directory (say /css) then your link in your css file will not work. Instead, either change the css link to point to a complete link:
background-image: url('http://mysite.com/images/background.jpg)
I am unsure if the '~' link will work in a stylesheet. Since your css is in the scripts folder, you should be able to do this:
background-image: url('../images/background.jpg')
it is getting confuse, because of your src
, it finding it in current_folder+src
, but your image folder is in root folder, for that to reach root_folder+src
you have to prefix your source with ~/
background-image:url('~/images/background.jpg');