我无法使用bootstrap正确地将组件放在一起

时间:2016-12-17 16:26:49

标签: twitter-bootstrap grid

我正在使用Twitter Bootstrap来编写我的页面。我研究了很多关于网格系统的资料,但我无法解决我的问题。我不知道我必须使用嵌套格栅。

在我的代码中,我想把头标记和输入框放在一起,但我不能......我使用了不同的Bootstrap编组类,但它没有用。我把我的代码放在这里:

<!DOCTYPE html>
<html lang="en" ng-app="confusionApp">

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head
     content must come *after* these tags -->
<title>Ristorante Con Fusion: Menu</title>
    <!-- Bootstrap -->
<link href="../bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="../bower_components/bootstrap/dist/css/bootstrap-theme.min.css" rel="stylesheet">
<link href="../bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="styles/bootstrap-social.css" rel="stylesheet">
<link href="styles/mystyles.css" rel="stylesheet">

<!-- HTML5 shim and Respond.js for 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/html5shiv/3.7.2/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>

<body>

 <div class="container">
    <div class="row row-content" ng-controller="DishDetailController as ctrl">
        <div class="col-xs-12">
          <div class="media">
              <div class="media-left media-middle">
                <a href="#">
                  <img class="media-object img-thumbnail" ng-src={{ctrl.dish.image}} alt="Uthappizza">
                </a>
              </div>
              <div class="media-body">
                <h2 class="media-heading">{{ctrl.dish.name}}
                <span class="label label-danger label-xs">{{ctrl.dish.label}}</span>
                <span class="badge">{{ctrl.dish.price | currency}}</span></h2>
                <p>{{ctrl.dish.description}}</p>
              </div>
            </div>
        </div>
        <div class="row">
          <div class="col-xs-9 col-xs-offset-1">
            <!-- I want put h3 and input box beside each other in one row -->
            <!-- sth like this: Customer Comments       sortby: "my inputBox " -->
              <h3>Customer Comments</h3>
              <label for="search">Sort by: </label>
              <input type="text" class="form-control" ng-model="filterText" id="search">
              <blockquote ng-repeat="comment in ctrl.dish.comments | orderBy:filterText">
                <p>{{comment.rating}} Stars</p>
                <p>{{comment.comment}}</p>
                <footer>{{comment.author}}, {{comment.date | date}}</footer>
              </blockquote>
          </div>
        </div>
    </div>

</div>

<script src="../bower_components/angular/angular.min.js"></script>

<script>

    var app = angular.module('confusionApp',[]);

    app.controller('DishDetailController', function() {

        var dish={
                      name:'Uthapizza',
                      image:'images/uthapizza.png',
                      category:'mains', 
                      label:'Hot',
                      price:'4.99',
                      description:'A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.',
                      comments: [
                           {
                               rating:5,
                               comment:"Imagine all the eatables, living in conFusion!",
                               author:"John Lemon",
                               date:"2012-10-16T17:57:28.556094Z"
                           },
                           {
                               rating:4,
                               comment:"Sends anyone to heaven, I wish I could get my mother-in-law to eat it!",
                               author:"Paul McVites",
                               date:"2014-09-05T17:57:28.556094Z"
                           },
                           {
                               rating:3,
                               comment:"Eat it, just eat it!",
                               author:"Michael Jaikishan",
                               date:"2015-02-13T17:57:28.556094Z"
                           },
                           {
                               rating:4,
                               comment:"Ultimate, Reaching for the stars!",
                               author:"Ringo Starry",
                               date:"2013-12-02T17:57:28.556094Z"
                           },
                           {
                               rating:2,
                               comment:"It's your birthday, we're gonna party!",
                               author:"25 Cent",
                               date:"2011-12-02T17:57:28.556094Z"
                           }

                       ]
                };

             this.dish = dish;

    });

</script>

</body>

 </html>

请帮助我.....

1 个答案:

答案 0 :(得分:0)

我认为只有使用网格系统才能解决这个问题。你能做的就是使用css。以下适用于我:

[j(cols[i]) for i=1:6,j in [red,green,blue]] 

在这里,我做了它作为内联样式。但是你可以在h3中添加一个类/ id并将它放在你的CSS文件中。