Displaying a Bootstrap card with ellipsis text-overflow following a short excerpt of text

When working on a web application using the Bootstrap library, I utilized card classes. The goal was to truncate text that was too long, as shown in the image below:

https://i.sstatic.net/4wKyT.jpg

However, the result I achieved looked different than expected:

https://i.sstatic.net/bIXuZ.png

I wanted the text to wrap over multiple lines instead of abruptly ending after the first line.

Here is my html code:

<div class="card mb-3">
              <div class="row no-gutters">
                <div class="col-md-4">
                  <img src="https://wallpaperstock.net/eclipse_wallpapers_26124_1280x720.jpg" class="card-img" alt="...">
                </div>
                <div class="col-md-8">
                  <div class="card-body">
                    <h5 class="card-title">Card title</h5>
                    <p class="card-text description-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
                  </div>
                </div>
              </div>
            </div>

And here is my css code:

.card-img {
  color: #fff;
  height: 10rem;
  object-fit:cover;
}

.description-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

I am looking for suggestions on what I can add or change to have the text extend to the edge of the card before being truncated.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unusual issue: PDF content disappears upon reopening modal

I am trying to incorporate a PDF display within a Bootstrap modal. Inside the .modal-body, I have inserted the following code: <object width="1000" height="500" data="path/to/pdf" type="application/pdf"> ...

Is it possible to automatically direct an iframe video to another video once it finishes

I'm having some trouble adding a video to my website. I want the video to redirect to another page on my site once it finishes playing. I've searched through various forums, but none of the solutions seem to work for my specific situation. Below ...

bootstrap 5 with uneven spacing

I am working on some HTML/CSS code that utilizes Bootstrap 5.2 and the justify-content-between class in order to move two buttons to the edges of a container. <div class="container"> <div class="row"> <div cla ...

What is the best way to ensure only one checkbox is checked at a time and have it automatically uncheck when another checkbox is selected?

Is there a way to make a checkbox automatically uncheck when another one is checked? For example, when checkbox one is clicked, it should be marked as checked and any other checkboxes should be marked as unchecked. The same behavior should apply when check ...

I am puzzled as to why this particular contact form is not functioning properly

I'm having trouble figuring out why my form isn't functioning properly. I receive a success message, but nothing is being delivered to my inbox. I even checked my spam folder to no avail. After waiting patiently for a few minutes, still no sign o ...

Tips for modifying the size of the <code> tag against a background?

Is there a way to adjust the width of text within a (code) tag so it always fits within the background? I want the text in the (pre) element to resize along with the background as the browser window resizes. Please see the pictures below for reference: I ...

Creating a single-level menu with Bootstrap using nested angular ng-repeat

I am currently working on developing a single level menu using bootstrap and angularJS. The menu is successfully functioning with JavaScript and HTML when the <li> element is dynamically created. Now, I am attempting to integrate AngularJS into the ...

What is the solution to prevent a CSS flex column from expanding to fill the width in a row with three

I am trying to create a flex row with three columns, but when I only have two columns in the row, the second column gets pushed to the right side. You can see this issue in the image below. https://i.sstatic.net/cVVqB.png In the image, the red lines indi ...

Which specific HTML element triggers the initiation of ajax in Jquery?

I have a situation where various HTML elements trigger ajax requests when clicked. My goal is to determine which specific element was clicked inside the ajaxComplete event. Although I attempted to use event.target, it only returns the entire document inst ...

Transferring information from a component that includes slot content to the component within the slot content

This task may seem complex, but it's actually simpler than it sounds. I'm struggling with the correct terminology to enhance the title. I need to transfer data from a component that includes slot content to that slot content component. In partic ...

Only scroll the div if it is not within the visible window

I've been looking at this snippet: The sidebar division is what I'm focusing on right now. I want the div to scroll along as I scroll down the page, but I need it to stop scrolling when its bottom is in view. The same should apply when scrollin ...

Are you interested in designing a bootstrap album for your homepage?

I'm currently working on designing an album-style layout similar to the examples provided below: if you look at the recent works section where you have an image on one side and text on the other, occupying the entire width of the page: or the example ...

Personalized Bootstrap 4 grid system

Could someone guide me on how to create this grid layout with Bootstrap 4? I am trying to achieve a design where one column stretches from the edge of the window to the inside, while the other column is half the width of a standard .container element. ht ...

Using Node.js to retrieve table data from a URL

My journey with Node JS and express is just beginning as I dive into building a website that serves static files. Through my research, I discovered the potential of using NodeJS with Express for this purpose. While I have successfully served some static HT ...

The input field does not accept any values even after setting it to be editable

Hey there! I have a specific requirement where I need to edit certain fields by clicking on an edit link. Initially, these fields will be disabled and in a readonly state. Once I click on the edit link, the field should become blank and editable. The issu ...

Steps for transferring data between two components

I'm looking for a way to transfer an object's id from one component to another. <ng-container matColumnDef="actions"> <mat-header-cell *matHeaderCellDef></mat-header-cell> <mat-cell *matCellDef="let user"> ...

Customized Bootstrap navigation bar

I am a newcomer to Bootstrap and I'm attempting to create a three-column navigation menu with the nav-links centered in the middle. While using grids or flexbox, I could easily accomplish this in five minutes. However, for some reason, I am struggling ...

The background image does not appear to be displaying correctly on GitHub pages

I've encountered an issue where my svgs are not displaying as background-image or background on GitHub pages, even though they work fine locally. I utilized sass as a preprocessor for css, in case that detail is helpful. If anyone has insights on how ...

Get only the text content from a hyperlink using Tinymce-4

Within tinymce.activeEditor, I currently have this line of innerHTML code (part of a ul-list): <li><a href="#">Important words</a></li> When I place the caret within the sentence "Important words," and click a button with the foll ...

Displaying article title above container with backdrop picture

Currently, I am working on a specific layout design using Bootstrap 5 where I am trying to render a tag outside its original container so that it takes up the full width of the page. My attempts with absolute positioning on the img tag have proven to be ch ...