Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 TextBox,旁边有一个带有 float:right 的 Button,两者都在一个具体宽度的 div 内。Button 具有由宽度和高度定义的具体尺寸。我希望 TextBox 占据 Button 左侧的整个剩余宽度(因为 Button 位于右边缘)。特别是,上面的 div 属于 SplitPanel 的左侧。当我拖动拆分时,我希望 TextBot 调整大小,而 Button 的大小应该保持稳定。我对 Css 不是很熟悉,因此我需要一个指示来克服这个(微不足道的?)问题。
如果您真的不担心旧浏览器,您可以使用新width: calc()方法:
width: calc()
input[type=text] { width: -webkit-calc(100% - 58px); /*add more with the other vendor prefixes*/ }
http://jsfiddle.net/Kyle_Sevenoaks/4Lmeg/