↓にて質問させていただいたのですがうまくいかなかったのでもう一度質問させてください。
http://okwave.jp/qa/q8552159.html
上記で教えていただいたことをもとに禁則処理により不自然な折り返しを解除しようとしたのですが
うまくいきませんでした。「line-break」というのも付けてみましたが結果は同じで不自然な位置で
折り返しが発生しています。試した環境はIE11になります。
下記がそのHTMLになります。
<html>
<head>
<style type="text/css">
td {
word-break: break-all;
word-wrap: break-word;
line-break: normal;
}
</style>
</head>
<body>
<textarea name="MSG" cols=40 rows=4 style="word-break: break-all;word-wrap: break-word;line-break: normal;">テスト中です。サンプルテキスト!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</textarea>
<table border="1">
<tr>
<td width="400" style="word-break: break-all;word-wrap: break-word;line-break: normal;">
テスト中です。サンプルテキスト!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
</td>
</tr>
</table>
</body>
</html>
No.1ベストアンサー
- 回答日時:
あー、うまく行きませんでしたか。
Chromeでは確認したのですが、IEでは確認していませんでした。すみません。
もうご存知と思いますが、禁則処理は英文字の長い単語が単語の途中で改行されないように改行位置を調整する処理です。また、それに加えて、文末の記号も同様の扱いで「.」「!」などがついていればそれも単語を構成する文字とみなされるはずだと思います。
実際にChromeではそのような動きで、文末の記号の連続でも一つの単語と同じように禁則処理・その解除が行われていました。
しかしIEでは文末の記号は別扱いで、文末記号は何があっても絶対に行頭に持ってこさせない処理を行っているようです。私にはChromeの動きが正しくIEの動きがバグのような気もします。そもそも行末記号が連続することが例外とも言えますので、考慮漏れをしているのかもしれません。しかし、もしかしたらMS社として正しいと思ってそのような仕様にしているのかもしれません。
結論として
少なくとも現行バージョンのIEでは、行末記号の連続の禁則処理の制御の解除はできません。
これを回避する正当な手段は現状では存在しないと思います。
対応としては
・行末記号の連続をやめる
・行末記号の連続中で、何文字かおきに半角スペースをいれる
・「!」の連続では画像を使う(これが一番いいかも)
・IEはあきらめる
位しかないと思います。苦肉の策ですが…
ご回答ありがとうございます。
私もChrome、FireFoxで試してみましたがIEはやはり
ダメでした。何とも恨めしく思っています。
IEはあきらめようと思います。どうもありがとうございました。
No.2
- 回答日時:
単純に!!
word-break:keep-all;でよいはずですが???
⇒5.3. Breaking Rules for Letters: the ‘word-break’ property( http://www.w3.org/TR/css3-text/#word-break-prope … )
【サンプル】
★タブは_に置換してあるので戻す。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="ja">
<head>
_<meta http-equiv="content-type" content="text/html; charset=Shift_JIS">
_<title>サンプル</title>
_<meta name="author" content="ORUKA1951">
_<meta http-equiv="Content-Style-Type" content="text/css">
_<link rev="made" href="mailto:oruka1951@hoge.com" title="send a mail" >
_<link rel="START" href="../index.html">
_<style type="text/css">
<!--
html,body{margin:0;padding:0;}
h1,h2,h3,h4,h5,h6{margin:0;line-height:1.6em;}
p{text-indent:1em;}
div.header,div.section,div.footer{width:90%;min-width:630px;max-width:900px;margin:0 auto;padding:5px;}
table,td{width:16em;}
div.word-wrap-normal td,div.word-wrap-normal text-area{word-wrap:normal;}
div.word-wrap-break-word td,div.word-wrap-break-word{word-wrap:break-word;}
div.word-break-normal td,div.word-break-normal{word-break:normal;}
div.word-break-keep-all td,div.word-break-keep-all{word-break:keep-all;}
div.word-break-break-all td,div.word-break-break-all{word-break:break-all;}
-->
_</style>
</head>
<body>
_<div class="header">
__<h1>タイトル</h1>
__<p>折り返しパターンのテスト</p>
_</div>
_<div class="section">
__<h2>word-wrap</h2>
__<p>折り返しパターンテスト</p>
__<blockquote cite="http://www.w3.org/TR/css3-text/#word-break-prope …
___<dl>
____<dt>normal</dt>
____<dd>Words break according to their usual rules.
____<dt>break-all>/dt>
____<dd>In addition to ‘normal’ soft wrap opportunities, lines may break between any two letters (except where forbidden by the ‘line-break’ property). Hyphenation is not applied. This option is used mostly in a context where the text is predominantly using CJK characters with few non-CJK excerpts and it is desired that the text be better distributed on each line.</dd>
____<dt>keep-all</dt>
____<dd>Implicit soft wrap opportunities between letters are suppressed, i.e. breaks are prohibited between pairs of letters (including those explicitly allowed by ‘line-break’) except where opportunities exist due to dictionary-based breaking. Otherwise this option is equivalent to ‘normal’. In this style, sequences of CJK characters do not break.
____</dd>
___</dl>
___<address><a href="http://www.w3.org/TR/css3-text/#word-break-prope … Text Module Level 3</a></address>
__</blockquote>
__<div class="section word-wrap-normal word-break-normal">
___<h3>word-wrap:normal(デフォルト) & word-break:normal(デフォルト)</h3>
<!-- 以下同文
___<form action="./">
____<textarea name="MSG" cols=40 rows=4" lang="ja">テスト中です。
サンプルテキスト!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</textarea>
___<table border="1" width="40">
____<tbody>
_____<tr>
______<td width="40">
_______テスト中です。
サンプルテキスト!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
______</td>
_____</tr>
____</tbody>
___</table>
-->
__</div>
__<div class="section word-wrap-normal word-break-keep-all">
___<h3>word-wrap:normal(デフォルト) & word-break:keep-all</h3>
<!-- 同文にてコピー -->
___</table>
__</div>
__<div class="section word-wrap-normal word-break-break-all">
___<h3>word-wrap:normal(デフォルト) & word-break:break-all</h3>
<!-- 同文にてコピー -->
__</div>
__<div class="section word-wrap-normal word-break-normal">
___<h3>word-wrap:break-word & word-break:normal(デフォルト)</h3>
<!-- 同文にてコピー -->
__</div>
__<div class="section word-wrap-normal word-break-keep-all">
___<h3>word-wrap:break-word & word-break:keep-all</h3>
<!-- 同文にてコピー -->
__</div>
__<div class="section word-wrap-normal word-break-break-all">
___<h3>word-wrap:break-word & word-break:break-all</h3>
<!-- 同文にてコピー -->
__</div>
_</div>
_<div class="footer">
__<h2>文書情報</h2>
__<dl class="documentHistry">
___<dt id="FIRST-PUBLISHED">First Published</dt>
___<dd>2013-03-03</dd>
__</dl>
_</div>
</body>
</html>
ご回答ありがとうございます。
テーブルの決まった幅の中で文章が右端まできたら言語に関係なく折り返すようにしたいと考えています。(禁則文字が行頭に来るような文章でも)。IEの禁則処理が働いてしまうようです。
お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!
関連するカテゴリからQ&Aを探す
おすすめ情報
- ・漫画をレンタルでお得に読める!
- ・14歳の自分に衝撃の事実を告げてください
- ・架空の映画のネタバレレビュー
- ・「お昼の放送」の思い出
- ・昨日見た夢を教えて下さい
- ・【お題】絵本のタイトル
- ・【大喜利】世界最古のコンビニについて知ってる事を教えてください【投稿~10/10(木)】
- ・メモのコツを教えてください!
- ・CDの保有枚数を教えてください
- ・ホテルを選ぶとき、これだけは譲れない条件TOP3は?
- ・家・車以外で、人生で一番奮発した買い物
- ・人生最悪の忘れ物
- ・【コナン30周年】嘘でしょ!?と思った○○周年を教えて【ハルヒ20周年】
- ・ハマっている「お菓子」を教えて!
- ・最近、いつ泣きましたか?
- ・夏が終わったと感じる瞬間って、どんな時?
- ・10秒目をつむったら…
- ・人生のプチ美学を教えてください!!
- ・あなたの習慣について教えてください!!
- ・牛、豚、鶏、どれか一つ食べられなくなるとしたら?
- ・都道府県穴埋めゲーム
デイリーランキングこのカテゴリの人気デイリーQ&Aランキング
-
htmlのolやulなどlistにtitleや...
-
cssで角丸で一部の画像だけを変...
-
hタグの右横に画像を表示
-
【CSS】HTML直書き→外部ファイ...
-
CSS 余白を作る方法
-
WEBサイト制作の図面作成ソフト...
-
画像の横にテキストを縦方向中...
-
htmlでdivをなるべく使わないで
-
動画を掲載すると最下部のフッ...
-
divとpの使いわけ
-
ブログのサイドバーが下にくる
-
htmlの文字が縦書きになる
-
【ヒトの神秘】美男美女から何...
-
smallにtext-allignが効かない
-
ol要素の番号とリスト項目の離...
-
「諸要素」とはどういう意味で...
-
widthやheightの数値に単位(px...
-
htmlでキャラクター画像を、サ...
-
<h1>、<h2>と<p><div>の行間を...
-
アコーディオンがうまくいかない。
マンスリーランキングこのカテゴリの人気マンスリーQ&Aランキング
-
htmlのolやulなどlistにtitleや...
-
HTML属性での「""」 「''」違い
-
html の divとtable の役割
-
複数のボタンを等間隔に、かつ...
-
<div id="container">の使いか...
-
div要素が重なってします
-
min-heightとheightの違いについて
-
1時間30分を簡単に表したいで...
-
ヘッダーとフッターだけ背景を...
-
ヘッダーを左右に二分割する方...
-
<!-- #BeginLibraryItemとは
-
h1に自分自身へのリンクを張...
-
html5でheaderの中にnav
-
画面を縮小するとカラムが落ち...
-
divを横に並べる方法
-
<div>テキスト</div>
-
スペースを使わず文字位置を揃...
-
h1のテキストサイズよりh2の方...
-
1サイト内にHTML5とXHTMLが混在...
-
オシャレな区切り線はありませ...
おすすめ情報