How can I word wrap text insided cards.
Here's the problem: plunker link
Do you have any idea how to fix it?
Use bootstrap text utilities to wrap or unwrap the text. Wrap text with a . text-wrap class. This text should wrap.
The . card-deck class creates a grid of cards that are of equal height and width.
Cards A card in Bootstrap 4 is a bordered box with some padding around its content. It includes options for headers, footers, content, colors, etc.
Introduction of Wrap Bootstrap The bootstrap wrap is used to cover or wrap the flex items in a flex container.It has main three classes which is.flex-wrap,.flex-nowrap,.flex-wrap-reverse.First is.flex-wrap for wrapping flax content. Second is.flex-nowrap for no wrapping in flex container.
Cards. A card in Bootstrap 4 is a bordered box with some padding around its content. It includes options for headers, footers, content, colors, etc. ... Add the .stretched-link class to a link inside the card, and it will make the whole card clickable and hoverable (the card will act as a link): John Doe.
We recommend migrating to the latest version of our product - Material Design for Bootstrap 5. Bootstrap cards are components which display content built of different elements with characteristic shadows, depth and hover effects. It is hard to think of a better way of displaying your content to users other than by using cards.
You need two rules:
max-width
for your .card
elements (because without defining a width CSS will not know where to break your long word) or overflow: hidden;
to make the .card
width no longer depend on the long word lengthword-wrap: break-word;
to tell the browser to break a word.card {
max-width: 100%;
}
.card-text {
word-wrap: break-word;
}
.card {
overflow: hidden;
}
.card-block {
word-wrap: break-word;
}
<link data-require="[email protected]" 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>
Simple:
/* For screens above: 576px */
.card{
overflow: hidden;
}
.card-text{
word-wrap: break-word;
}
https://plnkr.co/edit/BEbJehY8hkWpDoTfFJXz?p=preview
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With