问题描述
我正在制作一个名为Sweet Shoppe的网络游戏,并且正在使用GitHub Pages.唯一的问题是,CSS无法在GitHub Pages上运行.
I'm making a web game called Sweet Shoppe, and I'm using GitHub Pages with it. The only problem is, the CSS won't work on GitHub Pages.
我尝试将CSS文件放入主仓库(和文件夹中)并通过HTML导入,但是当我转到页面URL(设置为mreikono.github.io/Sweet-Shoppe)时)文件中包含的CSS(向主体添加灰色条纹背景)无法显示.
I've tried putting the CSS file in the main repo (and in a folder) and importing it through the HTML, but when I go to my page URL (which is set to mreikono.github.io/Sweet-Shoppe) the CSS that I have in the file (which adds a background of gray stripes to the body) fails to show up.
主要我想了解以下内容:将一些CSS导入GitHub Pages的正确方法是什么?
Mainly I want to know the following: What is the correct way to import some CSS into GitHub Pages?
推荐答案
就像引导程序一样,它覆盖了896行上的背景色.
Looks like bootstrap is overriding your background color on line 896.
body {
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #555555;
background-color: #ffffff;
}
尝试在引导程序后加载样式表,以便优先处理样式.
Try loading your stylesheet after bootstrap so that your styles are prioritized.
<head>
<!-- Extra code files -->
<!-- External files -->
<link rel="stylesheet" href="http://bootswatch.com/lumen/bootstrap.css">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-git2.js"></script>
<!-- CSS -->
<link href="styles/style.css" rel="stylesheet" type="text/css">
<!-- Misc attributes -->
<meta charset="utf-8">
<title>Sweet Shoppe</title>
</head>
https://developer.mozilla.org/zh-CN/docs/Web/CSS/Cascade
这篇关于为什么我的CSS无法在GitHub Pages上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!