word-wrap

CSS word-wrap: break-word not wrapping a tag unless you wrap it in div and add rule there

爱⌒轻易说出口 提交于 2019-12-06 08:49:21
问题 why does CSS rule a { word-wrap: break-word; } with <div> <a href="...">verylongurlherewithnospaces</a> </div> not wrapping and causing window to show scrollbar, whereas div { word-wrap: break-word; } will do the wrapping at its anchor child's text fine? UPDATE: just noticed (see L3ST-instance URL field at this form when you resize the window) that I needed word-break:break-all instead of word-wrap:break-word, apart from the suggested display:inline-block, so now using: a { word-break: break

How to find whether text in a text area is wrapped to multiple lines?

早过忘川 提交于 2019-12-06 08:33:51
How can I find whether a long text in a textarea is wrapped into two or more lines? I'm not talking about the new line chars as discussed here . I'm aware of the plugin Textarea Line Count Any simpler method? I experimented on this and came up with a hack that involves the following: Disabling text-wrapping in the textarea (plus disable padding) Checking if the textarea's scrollWidth is greater than it's width . The basic logic i used was that if the text is spanning multiple lines, that means when wrapping is turned off, we should get a horizontal scrollbar. Demo : http://jsfiddle.net/fnG3d/

Wrap text in td without breaking the word

谁说我不能喝 提交于 2019-12-06 07:46:09
I have an issue in word wrapping in CSS. I have a td where I have defined width as 300px . I have a url inside the td like http://www.abc.com/testing/testdata/testurl/test/testing.html When I use word-wrap: break-word , the text is wrapping as http://www.abc.com/testing/testdata/tes turl/test/testing.html But I do want the word to break. Like /tes in one line and turl in another line. I want it as, http://www.abc.com/testing/testdata/testurl/ test/testing.html Kindly help. Any help is appreciated. Thanks. Updated : I also have probability of getting text other than URL. Means I can't relay on

JavaFX: optimal width of TextFlow with word-wrap

无人久伴 提交于 2019-12-06 06:15:17
With Textflow.setMaxWidth(double) I can achieve text wrapping. But how can I adjust the width of TextFlow afterwards so that it is based on the actual wrapping position? In other words, how to let the TextFlow bounds snap to all of its children Text bounds to get rid of the empty space on the right: **Edit** I have made some progress on this issue. My class derived from TextFlow now contains: double maxChildWidth = 0; for (Node child : getManagedChildren()) { double childWidth = child.getLayoutBounds().getWidth(); maxChildWidth = Math.max(maxChildWidth, childWidth); } double insetWidth =

Multiline UILabel without word wrap?

可紊 提交于 2019-12-06 04:32:34
问题 Is it possible to have a UILabel that consists of multiple \n -delimited lines to have lines with their width > the label width to be truncated and not wrapped? Suppose I have some text like the following: This is a really long first line of text that is too long to fit horizontally Short line Another short line I want this to appear in my UILabel like so: 1. This is a really long first line of text... 2. Short line 3. Another short line However what is happening is I'm getting this: 1. This

Xcode 4.2 - UILabel Word Wrap

血红的双手。 提交于 2019-12-06 04:03:01
问题 I know people have asked this question a bunch of times alrdy on Stack, but the usual answer of changing "Lines: 0" and selecting "Line Breaks: Word Wrap" just isn't fixing it for me. I am using Xcode 4.2 with a Storyboard. I have placed a UILabel on a View Controller and resized it to cover most of the View. I have changed "Lines" value to 0 and "Line Breaks" value to Word Wrap. I have tried \n in my string: @"This is my label text \n that's supposed to wrap." Any ideas?? EDIT: I wasn't

Prevent single word from wrapping around float in css/html

折月煮酒 提交于 2019-12-06 03:25:11
问题 Is there any way to prevent a single word or two from wrapping around a float, but allow it if there is more text? Here is an example where the first text is problematic, but the second text is fine. http://jsfiddle.net/wdPCp/ <div class="wrapper"> <img src="http://lorempixel.com/100/100/animals" /> <div class="text">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut <span class="last-bit">labore et dolore magna aliqua. Ut enim ad minim veniam, quis

Enabling word wrap in a JTextPane with HTMLDocument

大兔子大兔子 提交于 2019-12-06 03:02:37
问题 Everywhere I read answers of people finding ways of enabling word wrapping in a JTextPane , but none of them work for me. I'm using an HTMLDocument (to display "text/html" content) and nothing that I have found so far got it to work. The JTextPane always cause the JScrollPane to scroll horizontally. I need the JTextPane to be scrollable, but only vertically. Would anyone have a workable demo of a word wrapping JTextPane displaying HTML content? 回答1: Use this as example to implement custom

Calculate how many characters (from a string) will fit into a div without making it wrap?

隐身守侯 提交于 2019-12-06 02:51:47
So I have a <div></div> . I want to know how much (in length) of a string will fit in it before it wraps to the next line. The script should take into account the width of the element (real clientWidth ), the left and right margins, and the left and right paddings. <div id="stackoverflow"></div> And JavaScript, assuming the magic function is calculate : calculate("#stackoverflow","the string to be inputed to the div"); // That should either output how much of the string fits in the div // or the string's length if it fits without wrapping. The selector #stackoverflow isn't important, it's just

Android TextView text not wrapping within RelativeLayout on version 2.3.3

余生颓废 提交于 2019-12-05 22:22:08
I have been trying to get a TextView to wrap the text to multiple lines on Android 2.3.3 for a while not but I can't seam to get it working, even on the most basic of levels. No matter what I do the text always just cuts off at the edge of the screen. It works just fine on Android 4 but I would like to target 2.3.3 as well. I have tried just the basic part here: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/mainDescText" android