html - future 版本的 HTML 或 CSS 中会有星号大小吗?

标签 html css

在 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-leftmargin-left 调整是让外部 DIV 的内容模型为 100% 减去 50px 宽度.

关于html - future 版本的 HTML 或 CSS 中会有星号大小吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2138250/

相关文章:

html - 如果第二个 div 为空,如何让 float div 跨越总宽度?

Jquery 模态对话框弹出 - 在所有浏览器中固定在屏幕中央

javascript - 如何在 React 中正确地将 css 文件包含在我的 index.html 文件中?

php - MPDF:无法显示 LTR 和 RTL 文本的混合

html - 使用 Bootstrap 在列上的图像全宽

jquery - 如何将多个CSS类选择器合并为一个?

html - 当我设置背景颜色但同时看不到我的下拉列表时

html - 固定标题与内容重叠

asp.net - 使用无序列表而不是表格会有很大的不同吗?

javascript - Angular 中的汉堡包图标滑出菜单