2013-03-13 53 views
4

我最近购买了一个引导主题,我尝试应用于我的MVC3 Web App项目。MVC3中的CSS背景图片 - 续

我有问题在social-icons.css中获取背景图片来渲染。

在_Layout.cshtml我已经引用:

link href="@Url.Content("~/Content/social-icons.css")" rel="stylesheet"  type="text/css" 
在头

在社会icons.css:

[class^="social-"], 
    [class*="social-"] { 
    display: inline-block; 
    width: 40px; 
    height: 40px; 
    margin-right: .3em; 
    line-height: 40px; 
    vertical-align: text-top; 
    background-image: url("img/icons/social-icon-set.png"); 
    background-position: 40px 40px; 
    background-repeat: no-repeat; 
    -webkit-transition: all 0.3s ease-in-out; 
    -moz-transition: all 0.3s ease-in-out; 
    -o-transition: all 0.3s ease-in-out; 
    -ms-transition: all 0.3s ease-in-out; 
    transition: all 0.3s ease-in-out; 
    -webkit-border-radius: 50em; 
     -moz-border-radius: 50em; 
      border-radius: 50em; 
} 

我已经检查了社会icons.css 和社会图标 - set.png两者的路径和一切似乎就起来了。

我检查了Q & A在这里,这并没有帮助我。 CSS background images in MVC3

想要提前为任何不清楚的信息道歉。

+1

你好Farrowdm ,并欢迎来到StackOverflow。 你的问题对我来说很好看,所以我希望我们能够帮忙。 – 2013-03-13 13:41:13

回答

2

您的图像位置错误。

这里是你拥有的一切:

background-image: url("img/icons/social-icon-set.png"); 

而且我们可以看到是你的截图,这是social-icons-set注意额外的 “s”):

enter image description here

+0

哈哈,我生病了我的胃。非常感谢你。 – farrowdm 2013-03-13 15:37:38

+1

@farrowdm呵呵没问题,这些事情都发生在我们大家身上!欢迎来到这里:) – mattytommo 2013-03-13 15:38:14

1

CSS文件中的任何路径总是相对于css文件本身。 是PNG位于Content/img/icons/social-icon-set.png

因为这是CSS文件和您的信息建议它的位置。

+0

是的,http://imgur.com/wOfaBgx – farrowdm 2013-03-13 13:51:49

+1

显然不是。 (见Mattytomo的回答) – 2013-03-13 14:59:54