twitter-bootstrap 引导 4 张卡片宽度

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47798830/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 01:11:17  来源:igfitidea点击:

bootstrap 4 cards width

twitter-bootstrapbootstrap-4

提问by random_user_0891

I cant seem to get a card to stretch across the whole width of a col-md-6 column unless there is enough text in the card to push it to full width. however, i would liek it to be full width of the col-md-6 column even with no text.

我似乎无法让卡片横跨 col-md-6 列的整个宽度,除非卡片中有足够的文本将其推至全宽。但是,即使没有文本,我也会认为它是 col-md-6 列的全宽。

If i uncomment that <p>tag then it fits the width perfectly, but i need to make it full width even with little to no text.

如果我取消注释该<p>标签,那么它完全适合宽度,但即使几乎没有文本,我也需要使其全宽。

<div class='col-md-6 jobs_index_middle_panels'>
  <div class="row">


<div class="card">
  <div class="card-block">
    <h4 class="card-title">Card title</h4>
    <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
    <!--<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>-->

  </div>
</div>        


    </div> <!--/.row -->
 </div> <!-- ./col-md-6 -->

回答by Zim

The card should be directly inside the col-*, and the col-*should be inside the .row...

卡应该直接在里面col-*,并且col-*应该在.row......里面

https://www.codeply.com/go/tBl8MZOn7i

https://www.codeply.com/go/tBl8MZOn7i

  <div class="row">
        <div class="col-md-6 jobs_index_middle_panels">
            <div class="card">
                <div class="card-block">
                    <h4 class="card-title">Card title</h4>
                    <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>

                </div>
            </div>
        </div>
  </div>