Bootstrap 3 offset on right not left

后端 未结 9 1509
情歌与酒
情歌与酒 2020-12-07 18:25

In regards to BS 3 if I wanted just a narrow column of content on the right I might use an offset class of 9 and a column of 3.

However, what if I wanted the reverse

相关标签:
9条回答
  • 2020-12-07 18:48

    <div class="row col-xs-12">            
                <nav class="col-xs-12 col-xs-offset-7" aria-label="Page navigation">
                    <ul class="pagination mt-0">                   
                        <li class="page-item">                        
                            <div class="form-group">
                                <div class="input-group">
                                    <input type="text" asp-for="search" class="form-control" placeholder="Search" aria-controls="order-listing" />
    
                                    <div class="input-group-prepend bg-info">
                                        <input type="submit" value="Search" class="input-group-text bg-transparent">                                   
                                    </div>
                                </div>
                            </div>
                        </li>
                       
                    </ul>
                </nav>
            </div>

    0 讨论(0)
  • 2020-12-07 18:50

    You need to combine multiple classes (col-*-offset-* for left-margin and col-*-pull-* to pull it right)

    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <div class="container">
      <div class="row">
        <div class="col-xs-3 col-xs-offset-9">
          I'm a right column
        </div>
        <div class="col-xs-3">
          We're
        </div>
        <div class="col-xs-3">
          four columns
        </div>
        <div class="col-xs-3">
          using the
        </div>
        <div class="col-xs-3">
          whole row
        </div>
        <div class="col-xs-3 col-xs-offset-9 col-xs-pull-9">
          I'm a left column
        </div>
        <div class="col-xs-3">
          We're
        </div>
        <div class="col-xs-3">
          four columns
        </div>
        <div class="col-xs-3">
          using the
        </div>
        <div class="col-xs-3">
          whole row
        </div>
      </div>
    </div>

    So you don't need to separate it manually into different rows.

    0 讨论(0)
  • 2020-12-07 19:01

    I'm using the following simple custom CSS I wrote to achieve this.

    .col-xs-offset-right-12 {
      margin-right: 100%;
    }
    .col-xs-offset-right-11 {
      margin-right: 91.66666667%;
    }
    .col-xs-offset-right-10 {
      margin-right: 83.33333333%;
    }
    .col-xs-offset-right-9 {
      margin-right: 75%;
    }
    .col-xs-offset-right-8 {
      margin-right: 66.66666667%;
    }
    .col-xs-offset-right-7 {
      margin-right: 58.33333333%;
    }
    .col-xs-offset-right-6 {
      margin-right: 50%;
    }
    .col-xs-offset-right-5 {
      margin-right: 41.66666667%;
    }
    .col-xs-offset-right-4 {
      margin-right: 33.33333333%;
    }
    .col-xs-offset-right-3 {
      margin-right: 25%;
    }
    .col-xs-offset-right-2 {
      margin-right: 16.66666667%;
    }
    .col-xs-offset-right-1 {
      margin-right: 8.33333333%;
    }
    .col-xs-offset-right-0 {
      margin-right: 0;
    }
    @media (min-width: 768px) {
      .col-sm-offset-right-12 {
        margin-right: 100%;
      }
      .col-sm-offset-right-11 {
        margin-right: 91.66666667%;
      }
      .col-sm-offset-right-10 {
        margin-right: 83.33333333%;
      }
      .col-sm-offset-right-9 {
        margin-right: 75%;
      }
      .col-sm-offset-right-8 {
        margin-right: 66.66666667%;
      }
      .col-sm-offset-right-7 {
        margin-right: 58.33333333%;
      }
      .col-sm-offset-right-6 {
        margin-right: 50%;
      }
      .col-sm-offset-right-5 {
        margin-right: 41.66666667%;
      }
      .col-sm-offset-right-4 {
        margin-right: 33.33333333%;
      }
      .col-sm-offset-right-3 {
        margin-right: 25%;
      }
      .col-sm-offset-right-2 {
        margin-right: 16.66666667%;
      }
      .col-sm-offset-right-1 {
        margin-right: 8.33333333%;
      }
      .col-sm-offset-right-0 {
        margin-right: 0;
      }
    }
    @media (min-width: 992px) {
      .col-md-offset-right-12 {
        margin-right: 100%;
      }
      .col-md-offset-right-11 {
        margin-right: 91.66666667%;
      }
      .col-md-offset-right-10 {
        margin-right: 83.33333333%;
      }
      .col-md-offset-right-9 {
        margin-right: 75%;
      }
      .col-md-offset-right-8 {
        margin-right: 66.66666667%;
      }
      .col-md-offset-right-7 {
        margin-right: 58.33333333%;
      }
      .col-md-offset-right-6 {
        margin-right: 50%;
      }
      .col-md-offset-right-5 {
        margin-right: 41.66666667%;
      }
      .col-md-offset-right-4 {
        margin-right: 33.33333333%;
      }
      .col-md-offset-right-3 {
        margin-right: 25%;
      }
      .col-md-offset-right-2 {
        margin-right: 16.66666667%;
      }
      .col-md-offset-right-1 {
        margin-right: 8.33333333%;
      }
      .col-md-offset-right-0 {
        margin-right: 0;
      }
    }
    @media (min-width: 1200px) {
      .col-lg-offset-right-12 {
        margin-right: 100%;
      }
      .col-lg-offset-right-11 {
        margin-right: 91.66666667%;
      }
      .col-lg-offset-right-10 {
        margin-right: 83.33333333%;
      }
      .col-lg-offset-right-9 {
        margin-right: 75%;
      }
      .col-lg-offset-right-8 {
        margin-right: 66.66666667%;
      }
      .col-lg-offset-right-7 {
        margin-right: 58.33333333%;
      }
      .col-lg-offset-right-6 {
        margin-right: 50%;
      }
      .col-lg-offset-right-5 {
        margin-right: 41.66666667%;
      }
      .col-lg-offset-right-4 {
        margin-right: 33.33333333%;
      }
      .col-lg-offset-right-3 {
        margin-right: 25%;
      }
      .col-lg-offset-right-2 {
        margin-right: 16.66666667%;
      }
      .col-lg-offset-right-1 {
        margin-right: 8.33333333%;
      }
      .col-lg-offset-right-0 {
        margin-right: 0;
      }
    }
    
    0 讨论(0)
提交回复
热议问题