css - Bootstrap 不工作

标签 css twitter-bootstrap

我想要做的就是让一些文本从屏幕中间开始。

这是下面的代码。请注意,我在我的元素目录中包含了缩小的 Bootstrap css 和 js 文件以及没有子目录的 html 文件。我从预编译的 Bootstrap 3.0.1 下载中获得了这些文件。我也尝试使用指向 CDN 的链接。仍然没有用。当我在 Firefox 中打开这段代码时,我根本看不到任何定位事件。其他 Bootstrap 样式也不起作用,就像我尝试做的那样 <p class = "large"> blah </p>它并没有使文本变大。

注意:为了让人们更容易测试页面,我用指向 Bootstrap CDN 文件的链接替换了指向本地 Bootstrap 文件的链接。

<!DOCTYPE html>
<html>
  <head>
    <title>Bootstrap 101 Template</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Bootstrap -->
    <!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap-theme.min.css">

    <!-- 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.3.0/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
    <div class="row">
      <div class="span3 offset9">
        <p class="large">This Text</p>
      </div>
    </div>

    <h1>Hello, world!</h1>
  </body>
</html>

最佳答案

在你的 jsfiddle 中,bootstrap 的东西没有被正确使用,它所需要的只是

<body>
    <div class="row">
    <div class="span9 offset3"><p>Seven thousand thousands of a thousand unique people</p></div>
</body>

和一些外部资源,http://jsfiddle.net/N5n4Z/1/ ,是一个 Bootstrap 2 骨架,其中包含您的示例,并且可以正常工作。好吧,除非预览窗口太小。如果 Window 太小,bootstrap 会根据其媒体查询自动安排所有行在下方,并忽略每个偏移量。

附带说明一下,为什么不使用新的 Bootstrap 3? http://getbootstrap.com/

更新

由于您现在使用的是 Bootstrap 3,因此您必须稍微更改标记。

<div class="row">
    <div class="col-md-6 col-md-offset-3">
    <p>test loc</p>
</div>

fiddle
bootstrap docu

关于css - Bootstrap 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19809082/

相关文章:

html - Internet Explorer 显示没有正确样式的 UL

css嵌入没有滚动条

css - 空间出现在 SVG 下方(仅在 Google Chrome 中)

html - 如何在 750 像素框的表格单元格内将 615 像素图像居中?

javascript - Polymer - 核心动画页面中的内容标签不占用高度

html - foundation4 无法将文本输入到输入类型 ="text"

javascript - 在 Bootstrap 中将事件类放在事件导航栏上

html - Figcaption 动画问题

javascript - 为什么我在 bootstrap 模式中的点击事件触发不止一次

html - Bootstrap popover 隐藏换行符