Dealing with text overflow within a column and ensuring that the text always expands horizontally to align with the column width

I have implemented a file input feature that displays the selected file's name in a column.

However, when the file name is too long, it expands vertically which causes readability issues. There is an option to force the text to expand horizontally, but if the width of the column is fixed, the complete filename does not appear and is truncated with three dots (...).

See DEMO

<div class="card bg-light mb-3" style="width:40%; height:500px; overflow-y:scroll">
    <div class="card-header">Attachment</div>
    <div class="card-body att">
        <input type="file" id="files" multiple (change)="detectFiles($event)" accept="image/*">
        <div *ngFor="let url of items">
            <div class="row attach">
                <div class="col">
                    {{url.fileType}}
                </div>
                <div class="col">
                    {{url.filename}}
                </div>
            </div>
        </div>
    </div>
</div>

View Image

Attempts Made:

white-space: nowrap;

This helped to expand the text horizontally, however, it caused alignment issues with the extension or within the column.

Answer №1

Include the following CSS code

white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

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

Issues with ASP.net CSS not functioning properly in Internet Explorer, although it works fine in Firefox, Edge, and

Hello everyone, After spending several hours debugging and researching, I have hit a roadblock and can't identify the issue. As a less experienced coder, I am reaching out to seek your help. I am currently working on an ASP.NET C# page that was cre ...

Managing Keyboard Input in React using TypeScript

Hey there! I'm currently working on a method that should automatically insert a specific string into a textbox when a particular key is pressed. The key in question is a non-printable character that may not be visible in most font styles, but can sti ...

Unable to generate file with Compass

In my attempts to compile a project using compass, I have experimented with both the gui app and the command line. However, I consistently encounter the same error message in both cases: "Nothing to compile. If you're trying to start a new project, yo ...

The conditional CSS file does not have precedence over the regular CSS file

Currently, my approach involves using conditional comments to connect to a CSS file named "IEonly.css" if the Internet Explorer version is not greater than 8. My goal is to modify certain properties in the standard CSS file. Oddly enough, IEonly.css effect ...

What causes the issue of observable subscription displaying incorrect data for a brief period during page refresh within a lifecycle hook?

I am facing an issue with subscribing to an observable within a component lifecycle hook. While the content is correctly displayed in the template, making changes to the DOM through a component method results in a strange behavior upon page refresh. Initia ...

Building a draggable modal that dynamically adjusts the window's width and height using HTML, CSS, JS (with JQuery)

I'm currently working on implementing a hidden modal in my application that only appears when a specific button is clicked. Here is the code that I have used to achieve this functionality: Modal HTML: <div style="width:500px; display:none;" id=" ...

Another return payload failing to retrieve the return value

I'm currently facing an issue where a function that should return a value is not being passed on to another function. Below is the code snippet in question: public _getProfileToUpdate() { return { corporateId: this.storeService.setStoreData().p ...

Showcasing a dynamic image as a task is being completed within a JavaScript function

Is there a way to show a loading image while waiting for a JavaScript function to finish? <script type="text/javascript"> function create() { //Perform operation } </script> I am looking for a solution to display a loading image until ...

PhpStorm is unable to resolve the @ionic/angular module

I have encountered a peculiar issue with my Ionic v4 project. While the project runs smoothly, PhpStorm seems unable to locate my references to @ionic. https://i.stack.imgur.com/umFnj.png Interestingly, upon inspecting the code, I realized that it is act ...

What causes the scrollTop to appear erratic?

There is a simple issue that I find difficult to explain in text, so I have created a video demonstration instead. Please watch the video at this link: The functionality on my page works perfectly when scrolling down, as it replaces images with the next i ...

Navigating in Angular - directing a URL to a specific component

I am encountering an issue with redirecting my app in production mode. When I try to access the URL http://server.com/project/dashboard, the server responds with an IIS error page 404. To workaround this, I need to open the app using the URL http://server. ...

Typescript types for the Google Calendar API

Is there anyone out there who can confirm whether the google Calendar API (via the npm package googleapis) for node.js or browser supports types that can be utilized in TypeScript? This would allow for a more strongly typed approach in projects using node ...

Defining a JSON file interface in Angular to populate a dropdown box with dependencies

I've embarked on an exciting project to develop a cascading dropdown box filter, and it's proving to be quite challenging. I'm taking it step by step to ensure clarity. I have obtained a JSON file containing the data required to populate de ...

Does the CSS overflow property affect the borders of an element?

Consider a situation where a "div" element has a border applied to it. When the overflow rule is set to 'hidden', any content that falls directly on the border will vanish. Is there a solution for this issue? It is crucial in my case to ensure t ...

Issue with CSS :hover not working due to jQuery altering CSS properties

My website has a specific set of <p class="first"> elements that change background color on hover using CSS. <div id="row_1"> <p class="first">first_1</p> <p class="first">first_2</p> <p class="firs ...

When Content Div and Menu Div collide: Resolving HTML and CSS Dilemmas

I am having an issue with my content navigation div overlapping the menu navigation div. Can anyone please help me figure out what I am missing here? You can find the fiddle link below: https://jsfiddle.net/y4c2xs5j/1/ HTML: <div class="top-nav"> ...

Can you use TypeScript to define generic React functional components?

I am looking to add annotations to a generic in a React functional component like the following: import React, {useEffect, useState} from "react"; interface PaginatedTableProps{ dataFetcher: (pageNumber: number) => Promise<any>, columnNames: ...

The footer lies at the bottom of the page, demarcated by

I'm struggling to position the footer at the bottom of the page with a horizontal line just above it. Despite trying various resources, I can't seem to get the footer to stay at the bottom. I'm currently using a blog template as the basis fo ...

Utilize Javascript to extract and showcase JSON data fetched from a RESTful API

I'm attempting to use JavaScript to pull JSON data from a REST API and display it on a webpage. The REST call is functioning correctly in the Firefox console. function gethosts() { var xhttp = new XMLHttpRequest(); xhttp.open("GET", "https://10 ...

Stylize the final element within a webpage using CSS styling techniques

In the code snippet below, my goal is to apply a specific style to the content of the final occurrence of "B". <div class="A"> <div> I am <span class="B">foo</span>. </div> <div> I like <span class="B"> ...