Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

css calc function replacement for android

Tags:

html

css

I have table, where second column is 120px wide. And I want to first column have width 100% of what left (100%-120px), but on android I can't use CALC function. Source: 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; }

Question:

How to replace calc(100%-120px) so it will work on Android?

Note: ( I don't know width 100% )

like image 661
Ing. Michal Hudak Avatar asked Oct 13 '25 01:10

Ing. Michal Hudak


2 Answers

Simply don't set a width on .one, or set it to auto, then set the parent table to 100%. This will cause the td with .one to fill the remaining space of the table.

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;
}
like image 118
crush Avatar answered Oct 14 '25 17:10

crush


Try this:

CSS

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

Here's a jsFiddle

like image 32
tom-19 Avatar answered Oct 14 '25 17:10

tom-19