简体   繁体   English

如何为中间有静态单词的单个单元格提供多个值

[英]How can I give more than one value to a single cell with a static word in the middle

I'm creating a editable html table, and I would like to know how can I give more than one value to a single cell with a static word in the middle, example:我正在创建一个可编辑的 html 表,我想知道如何为中间有一个静态单词的单个单元格提供多个值,例如:

I have this already:我已经有了这个:

 table { font-family: arial, sans-serif; border-collapse: collapse; width: 100%; } td, th { border: 1px solid #dddddd; text-align: left; padding: 8px; } tr:nth-child(even) { background-color: #dddddd; }
 <table> <tr> <th>Days</th> <th>Work Schedule</th> <th>Rest and Meal Interval</th> </tr> <tr> <td>Monday</td> <td contenteditable='true'>This is editable</td> <td contenteditable='true'></td> </tr> <tr> <td>Tuesday</td> <td contenteditable='true'></td> <td contenteditable='true'></td> </tr> <tr> <td>Wednesday</td> <td contenteditable='true'></td> <td contenteditable='true'></td> </tr> <tr> <td>Thursday</td> <td contenteditable='true'></td> <td contenteditable='true'></td> </tr> <tr> <td>Friday</td> <td contenteditable='true'></td> <td contenteditable='true'></td> </tr> <tr> <td>Saturday</td> <td contenteditable='true'></td> <td contenteditable='true'></td> </tr> <tr> <td>Sunday</td> <td contenteditable='true'></td> <td contenteditable='true'></td> </tr> </table>

And I would like to have this:我想要这个:

在此处输入图片说明

So the word às will always be in the middle of those cells, and I need a space before and after it to write some values.所以单词às将始终位于这些单元格的中间,我需要在它前后às一个空格来写入一些值。

If you want something in the same column, you'll need to change the td to contain two inputs and the text between, something like this:如果您想在同一列中包含某些内容,则需要更改td以包含两个输入和其间的文本,如下所示:

 table { font-family: arial, sans-serif; border-collapse: collapse; width: 100%; } td, th { border: 1px solid #dddddd; text-align: left; padding: 8px; } tr:nth-child(even) { background-color: #dddddd; } input { border: 1px solid #dddddd; text-align: left; box-sizing: border-box; width: 40%; height: 100% } span { width: 10%; margin-left: 5%; margin-right: 5%; }
 <table> <tr> <th>Days</th> <th>Work Schedule</th> <th>Rest and Meal Interval</th> </tr> <tr> <td>Monday</td> <td><input type="text"/><span>às</span><input type="text"/></td> <td contenteditable='true'></td> </tr> <tr> <td>Tuesday</td> <td contenteditable='true'></td> <td contenteditable='true'></td> </tr> <tr> <td>Wednesday</td> <td contenteditable='true'></td> <td contenteditable='true'></td> </tr> <tr> <td>Thursday</td> <td contenteditable='true'></td> <td contenteditable='true'></td> </tr> <tr> <td>Friday</td> <td contenteditable='true'></td> <td contenteditable='true'></td> </tr> <tr> <td>Saturday</td> <td contenteditable='true'></td> <td contenteditable='true'></td> </tr> <tr> <td>Sunday</td> <td contenteditable='true'></td> <td contenteditable='true'></td> </tr> </table>

Obviously some additional CSS will be needed to make it look pretty.显然,需要一些额外的 CSS 才能使它看起来漂亮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM