• About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us
AimactGrow
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing
No Result
View All Result
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing
No Result
View All Result
AimactGrow
No Result
View All Result

Strings in text-overflow: A Win for Truncated Textual content

Admin by Admin
December 4, 2026
Home Coding
Share on FacebookShare on Twitter


Chrome 157 applied text-overflow: following Firefox 9, which was launched in, uhhh… 2011. Safari 27.3 Beta has additionally shipped it, so we will anticipate it to be Baseline quickly.

However what does text-overflow: do, precisely? Effectively, text-overflow: ellipsis provides an ellipsis (…) to the top of the road field, changing nevertheless many characters it takes up. That is in contrast to text-overflow: clip (the default worth), which provides nothing.


This textual content is overflowing its container.

div {
  /* Dimension */
  inline-size: 170px;
  
  /* Stop wrapping */
  white-space: nowrap;
  
  /* Conceal any overflow */
  overflow-inline: hidden;
  
  /* Append string */
  text-overflow: "—";
}

First, the textual content should overflow a block container in its inline path. That’s why I’ve declared inline-size: 170px in that final instance, which, assuming that the writing-mode computes to horizontal-tb, determines the width.

Subsequent, white-space: nowrap prevents textual content wrapping, inflicting overflow every time there’s no room for the textual content within the inline path. Sure, which means text-overflow is for single-line textual content (for multi-line textual content, you need line-clamp).

The overflow should be set to something however seen.

And at last, text-overflow: "—" provides an em sprint (—) to the top of the road field whereas truncating nevertheless many characters it takes up.

Notice that the string might be clean (text-overflow: ""). This truncates any overflowing characters with out changing them, in contrast to the default text-overflow: clip, which might go away fractional characters behind.

What ought to the string be?

The hot button is making it apparent that the textual content is truncated. We will, once more, use an em sprint as they’re are usually for interruptions and abrupt cut-offs of dialogue.

There’s text-overflow: "…", however that is just about the identical factor as text-overflow: ellipsis. Nonetheless, […] can be utilized to truncate quotes whereas signaling that it’s an editorial omission or design choice, not the top of the quoted textual content. If we would like it to be clickable, one thing akin to [read more] (with the sq. brackets wanting like a makeshift button) is a typical format. Nonetheless, the text-overflow string isn’t clickable, and since sq. brackets already imply one thing, I don’t suggest this format.

Different widespread bracketed interpolations embrace [truncated], [sic], [snip], and [excerpt], so text-overflow: lends itself to extra use circumstances than you may assume.

Carets (▾) and chevrons (⌄) (sure, they’re strings) counsel expandability, however once more, the text-overflow string isn’t clickable, so we will’t use it to unclip the overflowing textual content. Nonetheless, we can make the aspect itself reply to :hover (or one thing):

Hover this container to disclose the total textual content.

div {
  /* Dimension */
  inline-size: 170px;

  &:not(:hover) {
    /* Stop wrapping */
    white-space: nowrap;

    /* Conceal any overflow */
    overflow-inline: hidden;

    /* Append string */
    text-overflow: "▾";
  }
}

It’s not animatable, although. Sorry, not even @starting-style.

There’s a two-value syntax too

Huh? For what?

Effectively, keep in mind how overflow might be set to something however seen? Effectively, if the container is scrollable (overflow-inline: scroll, for example), the two-value syntax can add ellipses/strings to each ends:


Hey, scroll this container.

div {
  /* Dimension */
  inline-size: 170px;

  /* Stop wrapping */
  white-space: nowrap;

  /* Conceal any overflow, permit scrolling */
  overflow-inline: scroll;

  /*   */
  text-overflow: "///" ellipsis;
}

is what seems after the textual content, whereas is what seems earlier than it. So, as we will see within the demo under, an ellipsis seems on the finish of the textual content if there’s extra of it to see, and the three ahead slashes (///) seems initially of the textual content if there’s extra of it to see. If the textual content is overflowing the container at each ends, we’ll see the ellipsis and /// on the identical time.

Solely Firefox have applied this two-value syntax:

Parts which can be being scrolled or centered components with editable content material fall again to text-overflow: clip in order that customers can see the textual content in full when attempting to work together with it. Nonetheless, this conduct can differ between browsers.

The place to subsequent?

text-overflow: permits us to look past ellipses, in the direction of customized strings that point out why the textual content was truncated. Additionally, the single-value syntax respects path, so it’s logical too.

However that’s not all; we even have text-overflow: fade() and] fade on the best way. text-overflow: fade(1em) would start fading the road 1em from the top of the road field whereas text-overflow: fade(10%) would start fading it 10% from the top, and in any case be fully clear by the top. text-overflow: fade does the identical factor however permits the consumer agent to find out the worth.

The line-clamp property is basically the identical as text-overflow, besides that it’s for multi-line textual content. It might probably, nevertheless, solely truncate the final line (not the primary line), and it doesn’t appear as if it’ll assist both fade() or fade.

Both manner, as soon as all of their options are supported by internet browsers, I believe text-overflow and line-clamp will turn out to be fairly helpful. We’ve been taking part in with line-clamping for an extended whereas now and it’s good to have new methods for it.

Tags: StringstexttextoverflowTruncatedWin
Admin

Admin

Next Post
The Batman Half 2 Star All however Confirms His Thriller Function

The Batman Half 2 Star All however Confirms His Thriller Function

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended.

Google Volatility Verify, AI Mode Expands Massive Time, ChatGPT Sends Much less Site visitors & SPN Advert Reporting

Google Volatility Verify, AI Mode Expands Massive Time, ChatGPT Sends Much less Site visitors & SPN Advert Reporting

August 25, 2025
16 Social Media Video Examples to Encourage Your Subsequent Video Advertising Marketing campaign

16 Social Media Video Examples to Encourage Your Subsequent Video Advertising Marketing campaign

April 24, 2025

Trending.

Resident Evil followers have adopted a Love & Deepspace character because the son of Leon S. Kennedy and one in every of his potential spouses

Resident Evil followers have adopted a Love & Deepspace character because the son of Leon S. Kennedy and one in every of his potential spouses

April 4, 2026
AI & data-driven Starbucks – Deep Brew

AI & data-driven Starbucks – Deep Brew

May 18, 2026
First AI designed drug in human trials

First AI designed drug in human trials

June 26, 2026
Authorized DUI PPC Companies in Atlanta

Authorized DUI PPC Companies in Atlanta

June 14, 2026
Self-Coding AI: Breakthrough or Hazard?

Self-Coding AI: Breakthrough or Hazard?

July 4, 2025

AimactGrow

Welcome to AimactGrow, your ultimate source for all things technology! Our mission is to provide insightful, up-to-date content on the latest advancements in technology, coding, gaming, digital marketing, SEO, cybersecurity, and artificial intelligence (AI).

Categories

  • AI
  • Coding
  • Cybersecurity
  • Digital marketing
  • Gaming
  • SEO
  • Technology

Recent News

Bronx Man Arrested in $6 Million Pretend Coinbase Help Rip-off

Bronx Man Arrested in $6 Million Pretend Coinbase Help Rip-off

December 5, 2026
This Is Why You Should not Enable Your Cellphone Or Laptop computer Battery To Discharge Absolutely

This Is Why You Should not Enable Your Cellphone Or Laptop computer Battery To Discharge Absolutely

December 5, 2026
  • About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us

© 2025 https://blog.aimactgrow.com/ - All Rights Reserved

No Result
View All Result
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing

© 2025 https://blog.aimactgrow.com/ - All Rights Reserved