简体   繁体   English

在浮动div中输入,并在表标题中输入全角

[英]input in floating div with full width in table header

I have a problem with input width when padding from sides is applied. 当从侧面填充时,输入宽度有问题。

I need for input width 100% and padding from sides. 我需要输入宽度为100%,并从侧面填充。 But I need to get this div with input next to the div with text "Name". 但是我需要在带有文本“名称”的div旁边输入该div。 This is what I have right now. 这就是我现在所拥有的。 All this is for filtering header of table. 所有这些都是为了过滤表头。 Can anyone suggest me a solution? 谁能建议我解决方案?

 .right{ overflow:hidden; background:red; margin-right: 10px; box-sizing: border-box; float: right; } .left{ background:green; box-sizing: border-box; padding-top: 10px; overflow:hidden; float: left; } .form-control{ display: block; width: auto; height: 34px; padding: 6px 12px; font-size: 14px; } .wrap{ width: 235px; } 
 <table> <th class="wrap"> <div class="left">Name</div> <div class="right"><input type="text" class="form-control" value=""></div> </th> </table> 

JSFiddle here JSFiddle在这里

Give your .left and .right class some width. 给您的.left和.right类一些宽度。

.left{
    width:20%;
 }

.right{
    width:70%;
   }

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

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