【发布时间】:2018-05-29 22:07:19
【问题描述】:
这个问题之前已经被问过几次了,但我从来没有见过我现在所处的这种情况。
我正在使用codeigniter 框架和bootstrap 作为前端框架来制作网站。因此,我的项目树大致是这样的
MyProject/
├── application/
├── system/
└── assets/
└── bootstrap
├── css/
│ └── bootstrap.min.css
└── fonts/
├── glyphicons-halflings-regular.eot
├── glyphicons-halflings-regular.svg
├── glyphicons-halflings-regular.ttf
├── glyphicons-halflings-regular.woff
└── glyphicons-halflings-regular.woff2
bootstrap.min.css 使用 font-face 包含这些字体,如下所示:
@font-face {
font-family: 'Glyphicons Halflings';
src: url('/assets/bootstrap/fonts/glyphicons-halflings-regular.eot');
src: url('/assets/bootstrap/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),
url('/assets/bootstrap/fonts/glyphicons-halflings-regular.woff2') format('woff2'),
url('/assets/bootstrap/fonts/glyphicons-halflings-regular.woff') format('woff'),
url('/assets/bootstrap/fonts/glyphicons-halflings-regular.ttf') format('truetype'),
url('/assets/bootstrap/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
由于某种原因,css 似乎只是跳过了整个部分,因为字体不仅不起作用,而且它们也没有显示在部分网络下的 chrome 的developer tools 中。它甚至没有显示错误,甚至不存在。
我该如何解决这个问题?
编辑 1
我注意到src 的url 不正确,但这只是一个小错误,因为这与错误未显示在chrome 的developer tools 中这一事实无关。
编辑 2 经过多次尝试,我注意到它在非常基本的 html 中也不起作用,如下所示:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello</title>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<p><span class="glyphicons glyphicons-search"></span> Hello</p>
</body>
</html>
然后我开始研究更多这种奇怪的行为,并偶然发现了这个链接,其中指出在 v4.0 中,字形图标已从引导程序中删除。这就是为什么我认为所有字形图标都从引导程序中删除了。
如果你认为我错了,看到我犯的错误,请回复。
【问题讨论】:
标签: css twitter-bootstrap codeigniter twitter-bootstrap-3