The fxFlex property is failing to truncate the span if it overflows

I am encountering an issue with my flex box and its span element.

My goal is to truncate the text when it overflows, hiding the overflow without displaying ellipsis.

<div fxFlexFill fxLayoutAlign="center center" class="over-line">
    <div fxFlex="0 0 60%" fxLayoutAlign="center center">
       <div class="truncate" fxLayoutAlign="start center">{{ mytext }}</div>
    </div>
</div>

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

After researching, I discovered that adding min-width:0 was suggested as a solution, however, it did not resolve the issue.

Upon further investigation, it was mentioned that using a span element might be causing the problem. I switched to a div element, but the outcome remained the same.

Where could the source of my problem lie?

Answer №1

Span elements behave as inline elements, but by giving them a display block property and setting a specific width, they can be controlled more effectively.

.truncate {
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
    width: 50px; 
    display: block;
} 
 
<div fxFlexFill fxLayoutAlign="center center" class="over-line">
    <div fxFlex="0 0 60%" fxLayoutAlign="center center">
       <span class="truncate" fxLayoutAlign="start center">{{mytext}} pakistan</span>
    </div>
</div>

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

Tool to track character limits in multiple text fields

I'm facing a challenge with a form that includes 3 text areas, a copy button, and a reset button. My goal is to concatenate all the characters in the text areas to get a sum which will be displayed next to the copy/reset button. The character limit is ...

With the addition of a key element in the opening statement

Take a look at this code snippet: <div class="content"> This is some title<br/> Some text<br/> And maybe more text. </div> I am trying to wrap the first sentence with a <span> tag before the <br/> element, like s ...

Is there a way to create a duplicate form without any pre-filled text when clicking the "next" button using JavaScript?

This form contains the details that I would like to display on the page again when clicking the "Add Another Module" button. <div> <form class="in-line" id="module_info"></form> <div style="display: flex;"> < ...

Retrieve JSON data from the website and use AJAX and jQuery to remove it

I am working on a local project with an app that contains a table of data. I need to download the data from a JSON file (todo.json) using jQuery and AJAX, display it in the table in HTML, and then be able to delete, update, and save individual objects or a ...

Expand the HTML Template and Resize Children to Fit the Window

My software creates HTML email templates that typically range from 600px to 650px in width, but can sometimes be as wide as 900px. The templates have nested table elements for email clients, with all dimensions specified in fixed pixels rather than relativ ...

"Enjoying a table header that scrolls freely with autoscroll feature

Resolved - http://jsfiddle.net/CrSpu/11704/ I'm facing an issue with a table that has autoscroll functionality. I am looking to freeze the header of the table when automatic scrolling occurs, or you can test it out using my code pen. I'm uncer ...

What could be causing this jQuery color picker to malfunction when used inside a Bootstrap modal?

Currently, I am utilizing the fantastic jQuery color picker provided by Although it functions as expected in "normal" scenarios, I have encountered an issue where the picker fails to display when the input parent element is nested within a Bootstrap 3 mod ...

The WordPress Customizer fails to update the CSS after making changes and saving them to an external stylesheet

I was looking for a way to improve the performance of my WordPress website by saving the styles from the Customizer into an external stylesheet for caching purposes. I found this code that allows me to save the custom styles into an external CSS file: $cs ...

Disable the button on page load condition

In the Mysql PHP setup, there is a page displaying a list of students with student_id, name, birthdate, and various buttons on each row. The objective is to make a certain button inactive if the student_id is found in another table called 'saral_tciss ...

Is there a way to automatically update the child option when the parent option is altered?

I am attempting to modify the child option based on the parent option selection, similar to how it works in Bootstrap. ` <div class="wrap-input100 input100-select bg1"> <span class="label-input100">Indus ...

Struggling to create a photo grid design that meets my expectations

I'm struggling to recreate this particular photo grid. Any tips on how I can achieve it? Check out the image here Just to clarify, I had a working prototype see image description using flexbox. However, one image didn't fit well so I resorted to ...

What is the importance of chaining selectors in order to utilize flexbox effectively?

Check out this code snippet: .flex-container { border: solid 1px purple; display: flex; } .flex-container div { border: solid 1px red; padding: 20px; margin: 20px; height: 100px; flex: 1 1 0%; } .flex-container ...

Discover the steps to trigger a Bootstrap popup modal when clicking on an anchor link using Angular

I have an Angular application and I would like to display a Bootstrap popup modal when the user clicks on a link in the footer. Here is the Bootstrap modal code: <button type="button" class="btn btn-primary" data-toggle="modal&q ...

Is it advisable to utilize $_GET for dynamically loading HTML content?

Currently, I am in the process of developing a social networking platform using PHP, MySQL(PDO), JQuery, and HTML(CSS). My focus at this moment is on the profile page where I want to distinguish whether the user is viewing their own profile or someone else ...

Modify Angular HTML attributes - update names

Currently, I am working with an HTML string that looks like this: <span class="diff-html-changed" id="1" changes="MyText">test</span> I want to display this text as HTML. To include it in my code, I perform the following steps: displayedCont ...

What is the best way to show a <div> element when the ID is present in the URL?

I am in need of a solution to display specific content on the document based on the presence of a particular ID in the URL. In the current process, users go through a series of security checks and receive a cookie at the end to avoid repeating the check fo ...

PHP - WebCalendar - Show or Hide Field According to Selected Item in Dropdown List

Working with the WebCalendar app found at to make some personalized adjustments to how extra fields function. I've set up two additional fields: one is a dropdown list of counties, and the other is a text field. Within the dropdown list, there is an ...

Using jquery to hide an input box once a checkbox is marked as checked

Is there a way to conceal the input box for a name when a checkbox is checked? if ($("#1step").checked){ $("input[username='true']").hide(); } <input username='true'> <input type="checkbox" id="1step"><label>ste ...

What is the best way to consistently update the name of a variable in PHP?

Forgive me in advance if my question seems a bit confusing. I currently have three separate PHP files. The first one prompts the user to select the quantity of products they want (between 1-20) using a variable called $quantity. Once a number is chosen fr ...

EJS unable to display template content

I am having an issue with rendering a template that contains the following code block: <% if(type === 'Not Within Specifications'){ %> <% if(Length !== undefined) { %><h5>Length: <%= Length %> </h5> <% ...