###前提・実現したいこと
tableのtd内で長文を改行させる方法御座いませんでしょうか?
###発生している問題・エラーメッセージ
長文を入力するとテーブル幅で改行されません。隣のテーブルにテキストが被ってしまいます。
参考キャプチャー
###ソースコード
html
1 <table class="mdl-data-table" > 2 <thead> 3 <tr> 4 <th>商品情報</th> 5 <th>配送先</th> 6 <th>見積内容</th> 7 <th>見積作成日</th> 8 9 </tr> 10 </thead> 11 <tbody> 12 <tr> 13 <td>ここに長い文章ここに長い文章ここに長い文章ここに長い文章ここに長い文章※キャプチャーのダイキンの商品名の箇所</td> 14 <td>ここに文章を入れる</td> 15 <td>ここに文章を入れる</td> 16 <td>ここに文章を入れる</td> 17 </tr> 18 </tbody> 19 </table> 20
CSSにこれらを設定しましたが、変化が御座いません。
word-wrap : break-word;
overflow-wrap : break-word;
table-layout:fixed;
CSS
1 2.mdl-data-table { 3 position: relative; 4 border: 1px solid rgba(0, 0, 0, 0.12); 5 border-collapse: collapse; 6 white-space: nowrap; 7 font-size: 13px; 8 word-wrap : break-word; 9 overflow-wrap : break-word; 10 table-layout:fixed; 11 background-color: rgb(255,255,255); } 12 .mdl-data-table thead { 13 padding-bottom: 3px; } 14 .mdl-data-table thead .mdl-data-table__select { 15 margin-top: 0; } 16 .mdl-data-table tbody tr { 17 position: relative; 18 height: 48px; 19 word-wrap : break-word; 20 overflow-wrap : break-word; 21 22 -webkit-transition-duration: 0.28s; 23 transition-duration: 0.28s; 24 -webkit-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); 25 transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); 26 -webkit-transition-property: background-color; 27 transition-property: background-color; } 28 .mdl-data-table tbody tr.is-selected { 29 background-color: #e0e0e0; } 30 .mdl-data-table tbody tr:hover { 31 background-color: #eeeeee; } 32 .mdl-data-table td, .mdl-data-table th { 33 padding: 0 18px 0 18px; 34 text-align: right; } 35 .mdl-data-table td:first-of-type, .mdl-data-table th:first-of-type { 36 padding-left: 24px; } 37 .mdl-data-table td:last-of-type, .mdl-data-table th:last-of-type { 38 padding-right: 24px; } 39 .mdl-data-table td { 40 position: relative; 41 vertical-align: top; 42 height: 48px; 43 border-top: 1px solid rgba(0, 0, 0, 0.12); 44 border-bottom: 1px solid rgba(0, 0, 0, 0.12); 45 padding-top: 12px; 46 word-wrap : break-word; 47 overflow-wrap : break-word; 48 box-sizing: border-box; } 49 .mdl-data-table td .mdl-data-table__select { 50 vertical-align: top; 51 position: absolute; 52 left: 24px; } 53 .mdl-data-table th { 54 position: relative; 55 vertical-align: bottom; 56 text-overflow: ellipsis; 57 font-size: 14px; 58 font-weight: bold; 59 line-height: 24px; 60 letter-spacing: 0; 61 height: 48px; 62 font-size: 12px; 63 color: rgba(0, 0, 0, 0.54); 64 padding-bottom: 8px; 65 word-wrap : break-word; 66 overflow-wrap : break-word; 67 box-sizing: border-box; } 68 .mdl-data-table th .mdl-data-table__select { 69 position: absolute; 70 bottom: 8px; 71 left: 24px; } 72 73.mdl-data-table__select { 74 width: 16px; } 75 76.mdl-data-table__cell--non-numeric.mdl-data-table__cell--non-numeric { 77 text-align: left; } 78 79 80.mdl-data-table__width { 81 width: 300px; } 82
###補足情報(言語/FW/ツール等のバージョンなど)
ブラウザはクロームで確認しています。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/02/11 08:24