How to use text-overflow in a table cell ? Last Updated : 06 Jun, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we will see how to use text-overflow in a table cell. A text-overflow property in CSS is used to specify that some text has overflown and hidden from view. Approach: The white-space property must be set to "nowrap" and the overflow property must be set to "hidden". The overflowing content can be clipped, display an ellipsis (‘…’), or display a custom string. Syntax: text-overflow: clip|string|ellipsis|initial|inherit; Example: In the following example,we will consider ellipsis to use the test-overflow property in a table cell. HTML <!DOCTYPE html> <html> <head> <style> table,th,td { border: 1px solid black; } table { width: 100%; } .first { width: 50%; } .ellipsis { position: relative; } .ellipsis:before { content: ' '; visibility: hidden; } .ellipsis span { position: absolute; left: 0; right: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } </style> </head> <body> <h2 style="color:green">GeeksforGeeks</h2> <b> <p>text-overflow in table cell</p> </b> <br/> <table border="1"> <thead> <tr> <th>First Name</th> <th>Last Name</th> <th>Age</th> </tr> </thead> <tbody> <tr> <td class="ellipsis first"> <span> Free Tutorials, Millions of Articles, Live, Online and Classroom Courses ,Frequent Coding Competitions ,Webinars by Industry Experts, Internship opportunities and Job Opportunities. </span> </td> <td class="ellipsis"> <span> Free Tutorials, Millions of Articles, Live, Online and Classroom Courses ,Frequent Coding Competitions ,Webinars by Industry Experts, Internship opportunities and Job Opportunities. </span></td> <td class="ellipsis"> <span> Free Tutorials, Millions of Articles, Live, Online and Classroom Courses ,Frequent Coding Competitions ,Webinars by Industry Experts, Internship opportunities and Job Opportunities. </span> </td> </tr> </tbody> </table> </body> </html> Output: Comment More infoAdvertise with us Next Article How to use text overflow property in CSS ? S sravankumar_171fa07058 Follow Improve Article Tags : Web Technologies CSS CSS-Questions Similar Reads How to use text overflow property in CSS ? In this article, we will see how to set text overflow property in CSS. The text-overflow property is used to specify that some text has overflown and hidden from view from the user. The text-overflow property only affects content that is overflowing a block container element. Syntax: text-overflow: 2 min read How to use text-align property inside a table in CSS ? Text align is a CSS (Cascading Style Sheets) property that is used to specify the horizontal alignment of text within an HTML element. It is commonly used to align text within a block-level element such as a paragraph, heading, or table cell. The "text-align" property accepts several values. left: I 5 min read How to Avoid CSS text-overflow to Ellipsis? The CSS text-overflow: ellipsis property is used to truncate text and display an ellipsis at the end of the text when it overflows its container. However, there may be cases where you want to avoid using this property. Fortunately, there are several approaches you can take to achieve this.Table of C 4 min read How to prevent text in a table cell from wrapping using CSS? Preventing text from wrapping in a table cell ensures the content stays on one line, maintaining the layout's integrity. Using the CSS property white-space: nowrap;, you can control text behavior, avoiding unwanted line breaks within table cells.Syntax:white-space: normal|nowrap|pre|pre-wrap|pre-lin 2 min read How to Prevent Text from Overflowing in CSS? Text overflow happens when an HTML element's content goes beyond the limits of its container. This could break the layout or hide content, which would result in an unpleasant user experience. Using overflow properties, changing the container width, and managing word wrapping and breaking are some of 4 min read How to merge table cells in HTML ? The purpose of this article is to explore the method of merging table cells in HTML using the rowspan and colspan attributes. By utilizing rowspan, multiple cells in a row can be merged or combined, while colspan enables the merging of cells in a column within an HTML table. This technique proves es 2 min read Like