css calc函数替换为android

时间:2013-09-10 12:44:05

标签: html css

我有桌子,其中第二列是120px宽。我希望第一列的宽度为100%(100%-120px),但在android上我不能使用CALC函数。资料来源:http://caniuse.com/calc

HTML:

<table>
    <tr>
        <td class="one">data</td>
        <td class="two">data</td>
    <tr>
<table>

CSS:

.one { width: calc(100%-120px); }
.two { width: 120px; }

问题:

如何替换calc(100%-120px)以便它可以在Android上运行?

注意:(我不知道宽度为100%)

3 个答案:

答案 0 :(得分:4)

只需在.one上设置宽度,或将其设置为auto,然后将父表设置为100%。这将导致带有.one的td填充表格的剩余空间。

FIDDLE

<table>
    <tr>
        <td class="one">data</td>
        <td class="two">data</td>
    <tr>
<table>

CSS

table {
    width: 100%;
}

.one {
    background-color: red;
}

.two {
    background-color: orange;
    width: 120px;
}

答案 1 :(得分:4)

试试这个:

<强> CSS

.one { width: 100%; }
.two { min-width: 120px; }

这是 jsFiddle

答案 2 :(得分:1)

Android浏览器现在支持

calc

http://caniuse.com/#feat=calc

相关问题