asp.net从css根文件夹中拾取图像

asp.net从css根文件夹中拾取图像,css,asp.net,Css,Asp.net,我写这个是为了从我的根文件夹中拾取图像: #sidebar h2 { margin: 0; padding: 20px 0 2px 30px; background: url(~/images/img05.gif) no-repeat left bottom; border-bottom: 2px solid #4A3903; } 我的图像在根文件夹中,但图像不显示 试试看 background: url('../images/img05.gif') no-repeat left bottom

我写这个是为了从我的根文件夹中拾取图像:

#sidebar h2 {
margin: 0;
padding: 20px 0 2px 30px;
background: url(~/images/img05.gif) no-repeat left bottom;
border-bottom: 2px solid #4A3903;
}
我的图像在根文件夹中,但图像不显示

试试看

background: url('../images/img05.gif') no-repeat left bottom;
理想情况下,它应该能起作用,因为它意味着从根上采摘。图像路径中缺少引号,因此图像可能未显示

#sidebar h2 {
margin: 0;
padding: 20px 0 2px 30px;
background: url("~/images/img05.gif") no-repeat left bottom;
border-bottom: 2px solid #4A3903;
}

@user3924437:欢迎您:,这个答案解决了您的问题吗?理想情况下~它应该可以工作,因为它意味着从根开始。尝试将图像路径置于``background:url~/images/img05.gif不重复左下角;