我在GitHub pages上主持了一个主题,此主题在localhost
环境中正常运行,但是当我主持此主题时,它不应用正在导入Google API的正确字体
差异
本地主机版
Githhub页面版
这是我的Index.html
页面
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no;">
<title>Sample Name</title>
<!--( b ) CSS Stylesheets -->
<!-- Bootstrap -->
<link type="text/css" rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Library -->
<link type="text/css" rel="stylesheet" href="library/font-awesome/css/font-awesome.min.css">
<link type="text/css" rel="stylesheet" href="library/popup/popup.css">
<link type="text/css" rel="stylesheet" href="library/owl-carousel/owl.carousel.css">
<link type="text/css" rel="stylesheet" href="library/owl-carousel/owl.theme.css">
<!-- STYLE Sheets -->
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/responsive.css">
<!--( c ) Javascript For Browser Support Issues -->
<script type="text/javascript" src="library/modernizr/modernizr.js"></script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="library/jquery-easing/jquery.easing.min.js"></script>
<script type="text/javascript" src="library/easy-pie-charts/jquery.easypiechart.min.js"></script>
<script type="text/javascript" src="library/mixitup/jquery.mixitup.min.js"></script>
<script type="text/javascript" src="library/popup/jquery.popup.min.js"></script>
<script type="text/javascript" src="library/owl-carousel/owl.carousel.min.js"></script>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript" src="library/gMap/jquery.gmap.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
</body>
</html>
当我使用firebug进行调试时,我在style.css
文件中看到了来自Google api字体的主题字体渲染
@import url(http://fonts.googleapis.com/css?family=Hind:300,500);
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,400italic);
#preloader {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #1a1b23;
z-index: 10000;
}
.loader { ...
那我该怎么办
答案 0 :(得分:5)
我认为这可能是因为github页面使用的是HTTPS,但字体URL是HTTP。
您可以尝试删除this example中的http:
吗?
答案 1 :(得分:0)
您可以使用//
访问外部网址
@import url(//fonts.googleapis.com/css?family=Hind:300,500);
@import url(//fonts.googleapis.com/css?family=Open+Sans:400,400italic)
答案 2 :(得分:0)
Rob 的回答完美地解决了我的问题。我刚刚将以下代码添加到我的 CSS 文件中。
@import url(//fonts.googleapis.com/css?family=Hind:300,500);
body {
font-family: Hind;
}