Bootstrap根本不工作,我不明白为什么

时间:2015-09-04 15:41:10

标签: css

   <!DOCTYPE HTML>
   <html>
   <head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">


    <link rel="stylesheet" href="css/style.css">
    <meta name="viewport" content="width=device-width, initial-scale=1">


    </head>
    <body>
        <div class="container-fluid">
        <p>akdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdf
            akdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdf
            akdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdf
            akdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdf
            akdsjfhalsdhjflashdfklasjhdfkljashdf</p>

        <p>akdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdf
            akdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdf
            akdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdf
            akdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdfakdsjfhalsdhjflashdfklasjhdfkljashdf
            akdsjfhalsdhjflashdfklasjhdfkljashdf</p>
         </div>
        <button class"btn btn-success" onclick="$(this).hide();"> Click Me!    </button>

         <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <script    src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
        <script src="js/myscript.js"></script>
        </body>
      </html>

这是无效的代码。你能帮帮我吗?当我调整屏幕大小时没有任何反应。任何帮助表示赞赏

2 个答案:

答案 0 :(得分:0)

如果您是在本地环境中编写代码,请确保您的互联网正常运行并且网址未被阻止,

  

https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css

因为您从托管位置获取css,所以如果该URL无法访问,则代码将无效。

如果有疑问,请尝试从本地磁盘引用bootstrap css。

答案 1 :(得分:0)

您的代码正常运作。

如果修复 HTML ,您可以看到以引导方式设置样式的按钮。而不是:

 <button class"btn btn-success" onclick="$(this).hide();"> Click Me!    </button>

你应该写:

 <button class="btn btn-success" onclick="$(this).hide();">Click Me!</button>

你错过了&#34; =&#34; class关键字后面的符号。

关于content-fluid类,它唯一能做的就是将 CSS 添加到元素中:

padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;

因此,当您调整窗口大小时,您几乎不会注意到任何更改。