Setting background image in asp.net (Master page)

前端 未结 4 963
悲&欢浪女
悲&欢浪女 2021-01-21 18:49

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\"          


        
4条回答
  •  天涯浪人
    2021-01-21 19:29

    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')
    

提交回复
热议问题