Our web application shows URLs in a table. For most of our users, these urls all start with the same elements, and end differently.
The URLs are often too long to be displayed completely in a table cell, so we use this:
white-space: nowrap;
The problem is that this truncates the content at the "end" of the string. Since the begining is the same the table is a bit useless because all cells have the same content.
Is there a way with CSS to specificy that the begining of the string should be replaced by an ellipsis, not the end?
Related
I am constructing an Excel document using ClosedXML.
I fill the cells with text. When the text is long, it breaks it into several lines in the middle of the word.
How can I make it break into lines only between the words, only on the white spaces?
For example: The word Establishment is broken into 2 and the column width is not changed. I don't want it to break words in two but only in between words and if necessary to increase column width.
Try this code (c#):
ws.Cells().Style.Alignment.SetWrapText(true);
where ws is the worksheet.
An HTML text area works fine with new lines ("\n") when they're after any other content in the text area, whether it be whitespace characters like spaces or tabs ("\t") or not.
However, when text area content begins with a new line (for example, "\ntest"), that new line gets cut off on display.
Any ideas on what causes this/how to remedy it?
This seems to be by the spec.
A single newline may be placed immediately after the start tag of pre and textarea elements. If the element's contents are intended to start with a newline, two consecutive newlines thus need to be included by the author.
Note that in the past there were some bugs in the various browsers regarding leading new lines in elements:
https://bugzilla.mozilla.org/show_bug.cgi?id=591988
https://bugs.chromium.org/p/chromium/issues/detail?id=62901
Is there any way to define a CSS class which would substitute the component's text's carriage returns (as coming from the DB, for example) with <br/> so that they are displayed as new line?
Currently, I have a table whose one field is a user entered note they enter in a popup form. They can make paragraphs in the textarea and the data loaded in the form text area for editing shows proper new lines but when it is updated and the popup closed, the main page's data table naturally does not convert the new line carriage return into new HTML line. My question is is there a way to do it via CSS?
I am using CSS word-wrap: break-word to display the note content in my table cell so that it wraps text into the new line within the cell, however, it does not do it for user entered new lines using , which are BTW stored and retrieved fine in the DB.
Might be a little late, but following up on Marc B's comment at the end, if you use white-space: pre-line or white-space: pre-wrap that seems to preserve line breaks and line wrapping at the same time.
pre-line: Collapses multiple sequences of white space
pre-wrap: Preserves multiple sequences of white space
MDN link: https://developer.mozilla.org/en/docs/Web/CSS/white-space
I am having issues wrapping some words in the item list.
I have converted item list into XSLT page. Tried setting column width to some value but it gets overridden and stretched out as cells contain some long words without spaces. I tried adding word-wrap: break-word; as inline styling, but it is instantly marked red with message:
This property is marked invalid because it's not supported by the
current schema.
If I save the page anyways it works how it's supposed to work, but if I navigate somewhere else from current list, everything resets and I am back to square one.
How do I fix this? Is there some global CSS which would enable the use of word-wrap? In essence, I want word wrapping in cells of standard view. Even of long space-less words.
I have a comment box, if they enter long one word, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
the box will break(text out of div), i have used overflow:hidden but my friend want it to break like normal text.
Any idea how to fix ?
In order for overflow to hide content that is larger than it's containers' dimensions, the container must have a set width. But even so, CSS doesn't break long words. (Except for IE, which has the word-wrap: break-word instruction. Further reading.)
If you're using some sort of server side processing (I assume you are), you could manipulate text content by breaking up long words at a preset length and thus avoid overflowing.
You need to use whatever server language you have to devise some way to break the string up. You could use a combination of regex (to check for long unbroken strings) and then combine it with some string split function in order to insert some newlines or something.