Achieving Fluid Width for Input Elements within Fixed-Width Containers
Question:
How can an input field be styled to occupy the available remaining space within its fixed-width container, without text wrapping or the need to determine label size beforehand?
Answer:
To achieve this effect, consider the following:
Example Code:
<form method="post"> <button>Search</button> <span><input type="text" title="Search" /></span> </form>
form { width: 500px; overflow: hidden; background-color: yellow; } input { width: 100%; } span { display: block; overflow: hidden; padding-right: 10px; } button { float: right; }
以上是如何使輸入欄位填滿固定寬度容器中的剩餘空間?的詳細內容。更多資訊請關注PHP中文網其他相關文章!