ある日から別の日にタスクをドラッグアンドドロップできるHTMLとJavascriptでカスタムカレンダーを作成しようとしています。最初の列と最後の2列を固定幅にし、残りの列(月曜日から金曜日)を流動的にして、テーブルが常に親の100%を占めるようにします。
私が抱えている問題は、Fluid TDがコンテンツの量に基づいて自動的にサイズを変更することです。つまり、タスクをある日から別の日にドラッグすると、列の幅がサイズ変更されます。月曜日から金曜日まで、コンテンツに関係なく、text-overflow:hiddenを設定せずに、まったく同じサイズにしたいです。(タスクは常に表示される必要があるため)
つまり、灰色の列は固定幅で、赤い列は流動的ですが、内容に関係なく互いに均一である必要があります。
編集:ドラッグアンドドロップ機能にjQueryを使用しているので、JavaScriptソリューションでも問題ありません(ただし、好ましくありません)。
HTML:
<table>
<tr>
<th class="row_header">Row Header</th>
<th class="fluid">Mon</th>
<th class="fluid">Tue</th>
<th class="fluid">Wed</th>
<th class="fluid">Thurs</th>
<th class="fluid">Fri</th>
<th class="weekend">Sat</th>
<th class="weekend">Sun</th>
</tr>
<tr>
<td>Before Lunch</td>
<td>This col will be wider than the others because it has lots of content...</td>
<td></td>
<td></td>
<td></td>
<td>But I would really like them to always be the same size!</td>
<td></td>
<td></td>
</tr>
</table>
CSS:
table {
width: 100%;
}
td, th {
border:1px solid black;
}
th {
font-weight:bold;
background:red;
}
.row_header {
width:50px;
background:#ccc;
}
.weekend {
width:100px;
background:#ccc;
}
.fluid {
???
}