Adding ellipsis in the end of truncated text [duplicate] - css

This question already has answers here:
CSS text-overflow: ellipsis; not working?
(18 answers)
Closed 7 years ago.
I have a text that needs to be truncated in some defined length (say 14) and I want to add an ellipses to the end of the truncated text.
Example Output:
Some text here...
Can this be done in CSS?

Css dont know the number of characters. It only knows box model. In a project i had worked on elipses with css but it is worst idea.
For a better approach use javacript.

Related

weburl with special CSS in it? [duplicate]

This question already has answers here:
How does `#:~:text=` in URL works to highlight text?
(2 answers)
What exactly is the `#:~:text=` location hash in an URL? [closed]
(1 answer)
Closed 3 months ago.
By adding the code #:~:text=[TEXT TO HIGHLIGHT] after a URL, the text is highlighted by browsers (I think all, except firefox).
For example, see how the "Top question" text is highlighted on the stackoverflow home page:
https://stackoverflow.com/#:~:text=Top%20Questions
I think it's some kind of special CSS for browser.
Does anyone know how and where this feature is documented?

How to highlight one specific word in text using only css? [duplicate]

This question already has answers here:
CSS "word" selector? [duplicate]
(4 answers)
Closed 3 years ago.
How to highlight one specific word in text using only css? I can`t add another tag inside tag p.
<p class="header_heading">
Some text that I need to highlight
</p>
Most likely you cannot do that unless you add some java script and parse text / add style for a single word.
Theoretically you can research for CSS pseudo element such as specific word or similar, but I do not remember anything that exists and can help unless you parse the content.

Letter Wrapping with CSS [duplicate]

This question already has answers here:
Break long word with CSS
(6 answers)
Closed 3 years ago.
I am using an editor on my page and the word wrapping works fine if they are actually words. Meaning there is a space after every few characters.
However, if I put my finger on a letter and keep pressing, then the editor will expand beyond the edge of the display.
So I believe the following does the word wrapping showing an scrollbar if necessary:
<div style="overflow:scroll;">
But that won't work for the above scenario. Do I need a different attribute?
What am I doing wrong? Thank you.
I believe what you are looking for is the word-wrap attribute, specifically break-word, which allows a long word to be broken into sections to allow for wrapping. Try the following:
div {
overflow-wrap: break-word; // standard
word-wrap: break-word; // older, but still needed in IE
}
<div>
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
</div>
You may also find some helpful information in this post and this post.

difference between div and span in simple language [duplicate]

This question already has answers here:
Difference between div and span
(3 answers)
Closed 9 years ago.
I need to submit an assignment in my college. Can somebody please explain me in one or two lines, what is the difference between div and span as I am not very good at css.
This question has been answered so many times on stackoverflow. Please do a little research before asking a question. Check any of the below links:
What is the difference between <p>, <div> and <span> in HTML&XHTML?
What is the difference between HTML tags <div> and <span>?
Difference between div and span

How can I make text appear on next line instead of overflowing? [duplicate]

This question already has answers here:
How to word wrap text in HTML?
(20 answers)
Closed 7 years ago.
I have a fixed width div on my page that contains text. When I enter a long string of letters it overflows. I don't want to hide overflow I want to display the overflow on a new line, see below:
<div id="textbox" style="width:400px; height:200px;">
dfssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssfddddddddddddddddddddddsdffffffffffffffffsdffffffffffffffffdfssssssssssssdf
</div>
Is there anyway to disable overflow and put the overflowing text on a new line??? Twitter does something like this but I can't figure it out with CSS it's possible they are using Javascript.
Can anybody help with this??
Just add
white-space: initial;
to the text, a line text will come automatically in the next line.
word-wrap: break-word
But it's CSS3 - http://www.css3.com/css-word-wrap/.
Try the <wbr> tag - not as elegant as the word-wrap property that others suggested, but it's a working solution until all major browsers (read IE) implement CSS3.
Well, you can stick one or more "soft hyphens" (­) in your long unbroken strings. I doubt that old IE versions deal with that correctly, but what it's supposed to do is tell the browser about allowable word breaks that it can use if it has to.
Now, how exactly would you pick where to stuff those characters? That depends on the actual string and what it means, I guess.

Resources