[英]Making a CSS input act like a table cell
Here is the fiddle of what I'm trying to achieve: demo 这是我要实现的目标的小提琴: 演示
.editable-field {
display: block;
justify-content: inherit;
width:100%;
height:100%;
}
.editable-input {
border: none;
font-size: inherit;
background: inherit;
color: inherit;
transition: 0.3s all linear;
width:100%
height:100%;
}
Even with 100% width and height, the input doesn't seem to stretch along the cell. 即使宽度和高度为100%,输入似乎也不会沿单元格延伸。
I have a table where the cells expand vertically if the text is long (which is what I want). 我有一张桌子,如果文本很长(我想要的),单元格会垂直扩展。 The problem is, if I want to have editable cells (such as the third one down in the demo), the input is static and doesn't "grow" with the text.
问题是,如果我想拥有可编辑的单元格(例如演示中的第三个单元格),则输入是静态的,并且不会随文本“增长”。 Is there a css-only way, or J-Query to fix this?
是否只有css方式或J-Query可以解决此问题?
The following solutions may works for you . 以下解决方案可能适合您。
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text/css'>
<div class="container">
<table>
<tr>
<td>Not Editable but very long and takes fffffffffffffff multiple lines</td>
</tr>
<tr>
<td>Not Editable</td>
</tr>
<td contenteditable >
asdfad
</td>
<tr>
<td>Not Editable</td>
</tr>
</table>
</div>
I used contenteditable . 我使用contenteditable 。 This is html5 feature .
这是html5功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.