简体   繁体   English

在 CSS 中添加固定大小的卡

[英]Add fixed size of card in CSS

I've tried and failed to adjust a fixed size for a card I'm implementing in my page.我已经尝试并未能为我在我的页面中实现的卡调整固定大小。

The thing is that, it only gets adjusted based in the amount of characters the "progress" has in the description.问题是,它只会根据描述中“进度”的字符数量进行调整。

Here is a picture of what I mean, and where I want it to have (the red line represents the desired size):这是我的意思的图片,以及我想要它的位置(红线代表所需的大小):

参考

Here is my code:这是我的代码:

<div class="container-xl container-fluid py-3">
               <div class="row">
                     <div class="card card-progress">
                        <div class="card-body">
                           <h3 class="pb-3">A title</h3>
                           <div class="h3 mb-2">A description</div>
                           <hr/>
                           <div style="padding-top: 2%"></div>
                           <div class="h5">Updated progress:</div>
                           <div class="progress mb-4">
                              <div
                                 role="progressbar"
                                 style="width: {{ $progress->progress }}%"
                                 aria-valuenow="{{ $progress->progress }}"
                                 aria-valuemin="0"
                                 aria-valuemax="100"
                                 class="progress-bar progress-bar bg-primary"
                              ></div>
                           </div>
                           <div class="d-flex justify-content-between">
                              <div class="text-left">
                                 <div>Progress made by:</div>
                                 <div class="text-primary h3 mb-0">
                                  <p>
                                  Daniel
                                </p>
                                </div>
                              </div>
                              <div class="text-right">
                                 <div>Current progress of the homework after this addition:</div>
                                 <div class="text-primary h3 mb-0">
                                  <p>
                                  87%
                                </p>
                                </div>
                              </div>
                           </div>
                           <a href="#" class="btn btn-danger"><i data-feather="trash" class="icon-light icons-sm"></i></a>
                           <a href="#" class="btn btn-warning"><i data-feather="edit" class="icon-light icons-sm"></i></a>
                        </div>
                     </div>
                  </div>
            </div>

Please do not offer hard-coded solutions.请不要提供硬编码的解决方案。

It looks like you're Bootstrap 4.看起来你是 Bootstrap 4。

So, the simplest solution would be to add the .w-100 class to the card.因此,最简单的解决方案是将.w-100 class 添加到卡中。 Which sets the width of the card to 100% of the container.它将卡片的宽度设置为容器的 100%。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM