html – Bootstrap 4 – 在卡片中包装

前端之家收集整理的这篇文章主要介绍了html – Bootstrap 4 – 在卡片中包装前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我怎样才能用文字包装文字.

这是问题所在:plunker link

你知道如何解决它吗?

解决方法

你需要两个规则:

> .card元素的最大宽度(因为没有定义宽度CSS将不知道在哪里打破你的长词)或溢出:隐藏;使.card宽度不再取决于长字长
>自动换行:break-word;告诉浏览器打破一个字

.card {
    max-width: 100%;
}
.card-text {
    word-wrap: break-word;
}
.card {
  overflow: hidden;
}
.card-block {
  word-wrap: break-word;
}
<link data-require="bootstrap@4.0.0-alpha.6" data-semver="4.0.0-alpha.6" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" />

  <div class="card-deck">
    <div class="card">
      <div class="card-block">
        <h4 class="card-title">Card title</h4>
        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
        <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small>
        </p>
      </div>
    </div>
    <div class="card">
      <div class="card-block">
        <h4 class="card-title">Card title</h4>
        <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
        <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small>
        </p>
      </div>
    </div>
    <div class="card">
      <div class="card-block">
        <h4 class="card-title">Card title</h4>
        <p class="card-text">supportingsupportingsupportingsupportingsupportingsupportingsupportingsupportingsupportingsupportingsupportingsupportingsupportingsupportingsupportingsupportingsupportingsupportingto additional content. This card has even longer content than the
          first to show that equal height action.</p>
        <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small>
        </p>
      </div>
    </div>
  </div>
原文链接:https://www.f2er.com/html/227746.html

猜你在找的HTML相关文章