Css Azure上具有引导图标的不同字体样式

Css Azure上具有引导图标的不同字体样式,css,asp.net-mvc,azure,glyphicons,Css,Asp.net Mvc,Azure,Glyphicons,我使用ASP.NETMVC5、Bootstrap3.3.6和Nuget安装的Glyphicons创建了Web应用程序。我对导航链接的字体样式有问题,只有那些添加了图标的链接。Azure上出现问题。为了清楚起见,将显示图示符图标。在azure上,它们更大,而且下列名称使用不同的字体,这是不正确的。有什么想法吗 我在localhost上的样式设置也有同样的问题,但我使用下面的代码修复了它。在{}节之前添加了.glyphicon:并从“Glyphicons半人”更改为.glyphicon{font-f

我使用ASP.NETMVC5、Bootstrap3.3.6和Nuget安装的Glyphicons创建了Web应用程序。我对导航链接的字体样式有问题,只有那些添加了图标的链接。Azure上出现问题。为了清楚起见,将显示图示符图标。在azure上,它们更大,而且下列名称使用不同的字体,这是不正确的。有什么想法吗

我在localhost上的样式设置也有同样的问题,但我使用下面的代码修复了它。在{}节之前添加了.glyphicon:并从“Glyphicons半人”更改为.glyphicon{font-family:inherit;}

bootstrap.css

@font-face {
  font-family: 'Glyphicons Halflings';
  src: url('../fonts/glyphicons-halflings-regular.eot');
  src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), 
  url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'),
  url('../fonts/glyphicons-halflings-regular.woff') format('woff'),
  url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'),
  url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
.glyphicon {
  position:  relative;
  top: 0px;
  display: inline-block;
  font-family: inherit;
  font-size: inherit;
  font-style:  normal;
  font-weight: normal;
  line-height: 1;

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.glyphicon:before{
  font-family: 'Glyphicons Halflings' !important;
  font-size: x-small;
}
我不知道为什么它不能在Azure上工作

我的代码的其余部分:

_Layout.cshtml

@Styles.Render("~/Content/css")
@Styles.Render("~/Content/jqueryui")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@Scripts.Render("~/bundles/jqueryui")

<div class="navbar-header">
    <a class="navbar-brand" style="padding-top:14px;font-family:Arial, Helvetica, sans-serif" href="/Home/Index">
        <span class="glyphicon glyphicon-home" style="font-size:14px"> Home Page</span></a>
</div>
<div class="navbar-collapse collapse">
    <ul class="nav navbar-nav">
        <li>@Html.ActionLink(" Offers", "All", "Offers", null, new { @class = "glyphicon glyphicon-road " })</li>
        <li>@Html.ActionLink("About", "About", "Home")</li>
        <li>@Html.ActionLink("Contact", "Contact", "Home")</li>                   
    </ul>
</div>
Web.config

</system.webServer>
  <staticContent>
    <remove fileExtension=".eot" />
    <remove fileExtension=".ttf" />
    <remove fileExtension=".svg" />
    <remove fileExtension=".woff" />
    <remove fileExtension=".woff2" />
    <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
    <mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
    <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
    <mimeMap fileExtension="woff" mimeType="application/font-woff" />
    <mimeMap fileExtension="woff2" mimeType="application/font-woff2" />
  </staticContent>
</system.webServer>

这是在IE中检查时“提供”导航链接的外观:

Glyphicons位于main文件夹/fonts/Glyphicons中。(eot、svg、ttf、woff、woff2)


所有引导css都位于main文件夹/Content/bootstrap*(css,map)

您的问题是绑定

在调试模式下本地运行时,
.css
文件将分别发送到浏览器。如果未处于调试模式(部署时),则将
.min.css
文件捆绑到一个文件中并发送。如果没有
.min.css
文件,它会动态缩小


换句话说,您的更改不在
bootstrap.min.css中,因此您的更改不会出现在部署的应用程序中。缩小
bootstrap.css
(有很多在线工具)并替换
bootstrap.min.css
的内容。或者最好不要使用引导文件(因此将bootsrap升级到较新版本并不困难),而是在一个单独的css文件中覆盖任何需要覆盖的内容,该文件在捆绑包中最后加载。

您的问题在于捆绑

在调试模式下本地运行时,
.css
文件将分别发送到浏览器。如果未处于调试模式(部署时),则将
.min.css
文件捆绑到一个文件中并发送。如果没有
.min.css
文件,它会动态缩小


换句话说,您的更改不在
bootstrap.min.css中,因此您的更改不会出现在部署的应用程序中。缩小
bootstrap.css
(有很多在线工具)并替换
bootstrap.min.css
的内容。或者最好不要使用引导文件(因此将bootsrap升级到较新版本并不困难),而是在一个单独的css文件中覆盖您需要的任何内容,该文件在捆绑包中最后加载。

您是否也有
bootstrap.min.css
?如果您在web.config中设置
,问题是否在本地发生?您在两个屏幕截图中的
文件比
css
文件少?@Paul Abbott-是的,我有bootstrap.min.css,当我设置问题时,问题存在于我的locaclhost上。当设置为“true”时,样式设置是确定的。@EdSF-在第二个屏幕截图上还有一条规则。glyphicon:在本地主机上呈现“提供”导航链接时应用之前。多亏了我添加到bootstrap.css中的这段代码,样式就可以了。Azure上似乎缺少此部分。您是否也有
bootstrap.min.css
?如果您在web.config中设置
,问题是否在本地发生?您在两个屏幕截图中的
文件比
css
文件少?@Paul Abbott-是的,我有bootstrap.min.css,当我设置问题时,问题存在于我的locaclhost上。当设置为“true”时,样式设置是确定的。@EdSF-在第二个屏幕截图上还有一条规则。glyphicon:在本地主机上呈现“提供”导航链接时应用之前。多亏了我添加到bootstrap.css中的这段代码,样式就可以了。Azure上似乎缺少此部分。
</system.webServer>
  <staticContent>
    <remove fileExtension=".eot" />
    <remove fileExtension=".ttf" />
    <remove fileExtension=".svg" />
    <remove fileExtension=".woff" />
    <remove fileExtension=".woff2" />
    <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
    <mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
    <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
    <mimeMap fileExtension="woff" mimeType="application/font-woff" />
    <mimeMap fileExtension="woff2" mimeType="application/font-woff2" />
  </staticContent>
</system.webServer>