简体   繁体   English

将CSS链接到引导程序时遇到问题

[英]Having trouble linking css to bootstrap

I am rather new to web dev, and am having trouble determining what is wrong with my code. 我是Web开发人员的新手,无法确定我的代码有什么问题。 I'm trying to customise bootstrap with my own css, yet it doesnt seem to be linking correctly? 我正在尝试使用自己的CSS自定义引导程序,但似乎链接正确吗? I tried changing something as simple as the background-color to the body which didn't work. 我尝试将像背景颜色这样的简单内容更改为无效的内容。 Ive attached an image of my project below 我已经在下面附加了我的项目的图片

这里

Am I linking it incorrectly? 我链接不正确吗? Help would be much appreciated. 帮助将不胜感激。

Edit: Image of CSS 编辑:CSS的图像 在此处输入图片说明

Edit 2: 编辑2:

Apparently I forgot to add "@import UTF-8;" 显然我忘了添加“ @import UTF-8;”。 to the CSS sheet, which seems to have fixed the issue. 到CSS工作表,似乎已解决了该问题。 Thanks everyone. 感谢大家。

Maybe the problem isn't the file linking. 也许问题不在于文件链接。 If bootstrap is loading on your project, that isn't the problem, but relative path isn't recommended. 如果引导程序正在您的项目上加载,那不是问题,但是不建议使用相对路径。 Instead, try to use absolute url path. 而是尝试使用绝对URL路径。

Maybe the problem is the css rule you are using. 也许问题是您使用的CSS规则。 if your rule can't ovveride the bootstrap rule, it will not work. 如果您的规则无法验证引导规则,那么它将不起作用。 Example

A.css A.css

.container > .item{
    background: red;
}

B.css B.css

.item{
    background: blue;
}

example http://codepen.io/maxjf1/pen/qrNNpE 例如http://codepen.io/maxjf1/pen/qrNNpE

post the css and the html you are having problem. 发布您的问题的CSS和HTML。

Try to place your custom.css before bootstrap.css. 尝试将custom.css放在bootstrap.css之前。 Cutrently, in case of having some common classes, the classes of bootstrap are considered. 最重要的是,在具有一些通用类的情况下,将考虑引导程序的类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM