twitter-bootstrap Twitter Bootstrap:CSS 不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22684165/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 20:22:44  来源:igfitidea点击:

Twitter Bootstrap: CSS not working

htmltwitter-bootstrap

提问by oneday

Here's the website: http://alweso.2ap.pl/koniugator/trarara.html

这是网站:http: //alweso.2ap.pl/koniugator/trarara.html

This is not the first website I'm making using Bootstrap, so I really don't know why it's not working. All files are in place, here's the code:

这不是我使用 Bootstrap 制作的第一个网站,所以我真的不知道为什么它不起作用。所有文件都已就位,这是代码:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
    <h1>Polish Verb Conjugator</h1>
    <div class="container">
      <div class="row">
      <div class="col-md-4 col-md-offset-4">
      <form action="owacewac.php" method="post">
Conjugate: <input type="text" name="verb"><br>
<input type="submit" class="btn btn-default">
</form>
</div>
</div>
</div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>

回答by MSadura

Your css file is not found, error 404. Change this line and should be ok:

找不到您的 css 文件,错误 404。更改此行应该没问题:

<link href="../css/bootstrap.min.css" rel="stylesheet">

<link href="../css/bootstrap.min.css" rel="stylesheet">

(relate path was wrong)

(相关路径错误)

回答by superstar3000

Just to help anyone searching and searching.

只是为了帮助任何搜索和搜索的人。

To solve my issue I had to make sure there were no errors in the browsers javascript console. If you have an error there it can make ALL your javascript (bootstrap stuff) not work. So check the console! I had some kind of error in bootstrap-tooltips. Messed EVERYTHING up.

为了解决我的问题,我必须确保浏览器 javascript 控制台中没有错误。如果您在那里遇到错误,它可能会使您的所有 javascript(引导程序)无法正常工作。所以检查控制台!我在引导工具提示中有某种错误。搞砸了一切。

Removed
//= require bootstrap-tooltips

Everything works now.

现在一切正常。

回答by WhiteLine

Google Chrome console says :

谷歌浏览器控制台说:

Failed to load resource: the server responded with a status of 404 (Not Found) 

then your css file is in a directory other than this

那么您的 css 文件位于除此之外的目录中

<link href="css/bootstrap.min.css" rel="stylesheet">

UPDATE

更新

your css file is here : http://alweso.2ap.pl/css/bootstrap.min.css

你的 css 文件在这里:http: //alweso.2ap.pl/css/bootstrap.min.css

then use

然后使用

<link href="../css/bootstrap.min.css" rel="stylesheet">

回答by Paris

The browser cannot find css/bootstrap.min.css. Most probably you haven't uploaded it yet, since the browser finds js/bootstrap.min.js, and navigating to http://alweso.2ap.pl/koniugator/cssthrows a 404 Page Not Found.

浏览器找不到css/bootstrap.min.css。很可能你还没有上传它,因为浏览器找到了js/bootstrap.min.js,导航到http://alweso.2ap.pl/koniugator/css会抛出一个 404 Page Not Found。

The server response headers indicate that you use nginx, which should properly serve this files if they were there. If you insist that the files are uploaded, you have to check the nginx configuration to make sure no strange rules for css files exist.

服务器响应标头表明您使用 nginx,如果这些文件在那里,它应该正确地提供这些文件。如果你坚持上传文件,你必须检查nginx配置以确保不存在css文件的奇怪规则。

回答by Mugé

In my case, I made a mistake in my .htaccess file by using a different website address. The night before I had worked long hours and mis-uploaded another website's .htaccess file. Checking for errors with Mozilla console helped to find the error.

就我而言,我使用不同的网站地址在我的 .htaccess 文件中犯了一个错误。在我长时间工作并错误上传另一个网站的 .htaccess 文件的前一天晚上。使用 Mozilla 控制台检查错误有助于找到错误。