Adjust the table header so that it spans two lines and ends with three dots

There is a table with thead and I need to modify the elements inside it so that if the header text is longer than two lines, the remaining part of the text will be shown with three dots. Unfortunately, instead of inserting line breaks, I can only use white-space:nowrap to keep everything on one line.https://i.sstatic.net/AeHRC.png

How can I achieve this?

UPDATE: When I add the following code:

.table thead th {
    display: -webkit-box!important;<br>
   -webkit-line-clamp: 2!important;<br>
   -webkit-box-orient: vertical!important;<br>
   overflow: hidden!important; 
}
, it displays the column of the table vertically like in this image: https://i.sstatic.net/drT5h.png

Answer №2

Implement the following CSS rules:

.element {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;  
  overflow: hidden;
}

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

search engine optimized for easy input via keyboard

I have successfully incorporated AJAX search functionality into my project, inspired by this example here. The unique feature of this implementation is the ability to navigate through search results using the TAB key. The structure of my search results tab ...

Is there a way to modify the HTML layout for responsiveness?

Is there a way to adjust the layout of an HTML structure for both desktop and responsive mode? https://i.sstatic.net/skAP5.jpg <div class="header grid py-3"> <div class="logo_and_title grid"> <div class=&quo ...

Hover effect triggered upon mouse exit

As I delve into learning the basics of HTML and CSS, I came across the :hover property in CSS. This unique feature allows for a specific action to occur when the cursor hovers over an element, based on the code provided. Additionally, I discovered the tran ...

Ways to initiate a CSS transition without hovering over it

Currently, I have a sidebar that is hidden and only shows up when the mouse hovers over it. I'm wondering how I can make the CSS transition trigger before the mouse hover, similar to what happens in this sidebar link: . Any advice on how to achieve th ...

Implementing nested popup windows using Bootstrap

I am facing an issue with my two-page sign-in and sign-up setup in the header of my angular2 project. On the sign-up page, I have a link that should redirect to the sign-in page when clicked, but I am struggling to make it work. Can someone provide guidanc ...

Sticky Sidebar Attached to Parent Container with Smooth Sliding Effect

Is it possible to have my sidebar push the content across when opened, while keeping the fixed navigation relative to its parent element instead of the viewport? The sidebar works fine in Firefox but breaks out of the parent in Chrome. Link to JSFiddle & ...

Two div elements refusing to be positioned side by side

I'm struggling to position two div elements next to each other, with a third one to be added later. I've experimented with floating, display, and positioning options, but nothing seems to work. I've even copied code from other websites, but ...

What is preventing me from using the JavaScript toggle button multiple times?

I am currently trying to implement a JavaScript toggle button in two different sections on the same page, but I am encountering difficulties. I attempted to change the IDs as well, but it didn't seem to work. Is it not possible to achieve this, or am ...

Is the navigation dropdown toggle triggered by both mouseout and when hovering off of it?

I'm looking for some assistance in modifying the code so that the dropdown menu not only hides on click, but also hides on mouseout and/or when another top-level menu button is hovered over. View jsfiddle example $(document).ready(function () { ...

Position a button to be aligned with the bottom of its container

My goal is to have the button positioned at the bottom of the red div, nested inside it. .grand-parent { display: flex; flex-direction: row; flex-wrap: wrap; height: 300px; background-color: green; } .pa ...

What could be causing my div elements to not appear on the page?

Hey there, this is my debut post here so bear with me on the formatting. I'm currently working on a project and encountering some hurdles with my divs. Even though I've left space for them, I just can't seem to get my divs (or cards) to disp ...

Implementing a Bootstrap 4 modal in Webpack 2

Utilizing only the bootstrap modal functionality, I manually included the required libs (modal.js & util.js) in the vendor section of webpack.config.js If I directly add the vendor.js file, everything works fine. However, since it is bundled, I prefer ...

Including local directories in the Laravel header

I am struggling to properly integrate a custom Bootstrap folder and CSS into my Laravel index. Despite several attempts, I have not been successful. Any guidance on how to accomplish this would be greatly appreciated. I have placed the necessary folders i ...

The flex-box has been elongated

There is an issue with the image gallery in this example where boxes 1 to 9 are stretching downward, as shown in the snippet. I have attempted to set them with a fixed size using align-content and align-items, but I have not had any success. If I adjust ...

Why is my INSERT query failing after the first AJAX call loop?

I am working with a JavaScript function named db_input: function db_input(dataString,x){ $.ajax({ url: "custom_scripts/db-input.php", type: "POST", dataType:'json', data: dataString, cache: false, ...

Why does the Leaflet map appear inconsistently?

It's baffling that Firefox 24.0 and the latest Chrome are both failing to load my Leaflet map, but surprisingly, it works perfectly on Safari on my iPhone. Quite an interesting dilemma. This is my initial attempt at using Leaflet and Bootstrap...ever ...

What is the best way to ensure that the table header is printed on every page when printing?

My table has a large number of dynamic rows, and when I try to print or preview it using the window.print() function, only the table header (thead) appears on the first page. How can I make sure that the table header appears on each printed page? <div ...

When the CSS grid is equipped with a sticky left column, it will horizontally scroll if the grid's width exceeds 100% of its containing element

I am facing an issue with a CSS grid layout that has sticky left and right columns as shown below: .grid { display: grid; grid-template-columns: repeat(10, 200px); } .grid > div { border: 1px solid black; background-color: white; } .sticky- ...

What is the best way to define a style without affecting classes and their descendants?

I am facing an issue with styling a div on my webpage. I want to write some less code to style divs with a specific class and all their children. Below is the simplified HTML: <div class='people'> <div> <!--This text ...

HTML scroll bar functioning intermittently

Here is my code snippet. table#projectTable > tbody , table#productTable > tbody{ height: 300px; overflow: auto; } The scrollbar is functional when clicking the top part, but not the bottom. It's quite odd. Upon usin ...