• IE6, IE7: stretch the last value of li to the cumulative width of the previous li

    Given this markup:

    <ul class="grafiek">
        <li class="first-child">item</li>
        <li>item</li>
        <li>item</li>
        <li>item</li>
        <li>item</li>
        <li class="last-child">item</li>
    </ul>
    

    How can I do this, cross browser, for example:

    alt text

    In other words: the last element (with a fake pseudo-class last-child) should always be stretched to accommodate the total aggregate width of previous arbitrary sums (within reason), <li>'s

    This is what I have so far:

    ul.grafiek {
        float: left;
    }
    ul.grafiek li {
        float: left;
        display: block;
        margin-left: 6px;
        width: 56px;
        height: 66px;
        padding: 12px 0;
        color: #fff;
        text-align: center;
        font-size: 11px;
        line-height: 1;
        background-color: #c5015a;
    }
    ul.grafiek li.first-child {
        margin-left: 0;
    }
    ul.grafiek li.last-child {
        clear: both;
        margin: 10px 0 0 0;
        width: 100%;
        height: 23px;
        padding: 0;
        line-height: 23px;
        background-color: #0a2d7f;
    }
    

    IE6 stretches the latter <li>to the total width of the parent <ul>. IE7 does not stretch it at all. How can I get these two browsers to work?

    PS: Firefox, Chrome, and Opera are waiting.

    +3
    source share
    4

    ul.grafiek ? , IE, .

    +1

    position: relative; / zoom: 1; ul.grafiek

    +1

    , , , CSS-, , . IE6 100% , . ( IE7 , .)

    , , , ( ), UL LI ( , ).

    , UL :

    <ul class="grafiek items6_grafiek">
        <li class="first-child">item</li>
        <li>item</li>
        <li>item</li>
        <li>item</li>
        <li>item</li>
        <li class="last-child">item</li>
    </ul>
    

    CSS:

    .items1_grafiek {width: 56px}
    .items2_grafiek {width: 118px}
    .items3_grafiek {width: 180px}
    .items4_grafiek {width: 242px}
    .items5_grafiek {width: 304px}
    .items6_grafiek {width: 366px}
    

    , , JS, itemsN_grafiek .

    0

    , . - , , ( CSS ) , .

    ul.grafiek :

    ul.grafiek {
        float: left;
        position: relative;      
        border: 1px dashed gray; /* just for visualization while working on the problem */
        margin: 0;               
        padding: 1px;
        *padding-bottom: 33px;
    }
    

    *position: absolute; *bottom: 0; ul.grafiek li.last-child, , Firefox 3.6, Safari 4, IE6 IE7.

    , li IE . , doctype, IE6.: |

    0

    Source: https://habr.com/ru/post/1767724/


    All Articles