在 WPF 中,您可以通过将宽度设置为星号来设置列的宽度以占据剩余空间。 future 版本的 HTML 或 CSS 中是否会有类似的东西?
例子:
<div style="float: left; width: 50px;">
Occupies 50px of the page width
</div>
<div style="float: left; width: 1*;">
Occupies 25% of the rest of the page width
</div>
<div style="float: left; width: 3*;">
Occupies 75% of the rest of the page width
</div>
如果这可以在未来版本的浏览器中实现,那将真正帮助 Web 开发人员。
最佳答案
有一个template layout module for CSS 3做类似的事情。
编辑 但您已经可以这样做了:
<div style="padding-left: 50px">
<div style="float: left; width: 50px; margin-left: -50px;">
Occupies 50px of the page width
</div>
<div style="float: left; width: 25%">
Occupies 25% of the rest of the page width
</div>
<div style="float: left; width: 75%;">
Occupies 75% of the rest of the page width
</div>
</div>
额外的 padding-left
和 margin-left
调整是让外部 DIV
的内容模型为 100% 减去 50px 宽度.
关于html - future 版本的 HTML 或 CSS 中会有星号大小吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2138250/