导入外部bootstrap css无法正常工作

时间:2015-02-03 11:53:15

标签: css twitter-bootstrap

.bootstrap {
    @import url("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js");
}

这不起作用。有任何想法吗?有没有办法调试这个?

谢谢!

2 个答案:

答案 0 :(得分:1)

你应该试试

 @import url("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js");

为什么要换成boostrap{}

答案 1 :(得分:1)

仅在css文件中使用@import

 @import url("stylesheetB.css");

所以在你的情况下

 @import url("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css");

reference

js文件的

使用script标记

 <script src=https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js></script>

在css下访问getbootstrap以熟悉bootstrap类和grid

这意味着完整的HTML结构元素

&#13;
&#13;
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
    <title></title>
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimal-ui" />
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <meta name="author" content="" />
    <link rel="shortcut icon" href="favicon.ico">
    <!--<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />-->
  <style>
  @import url("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css");
   
</style>
</head>

<body>

  <header>
<!-- header content goes in here -->
  </header>

  <nav>
<!-- navigation menu goes in here -->
  </nav>

  <section id="sidebar1">
<!-- sidebar content goes in here -->
  </section>

  <section id="main" class=container>
<!-- main page content goes in here -->
  </section>

  <aside>
<!-- aside content goes in here -->
  </aside>

  <footer>
<!-- footer content goes in here -->
  </footer>
 <script src=https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js></script>
   </body>
</html>
&#13;
&#13;
&#13;