Google

Kategorie

Reprezentacja Wiedzy

Kalendarz

June 2007
M T W T F S S
« May   Jul »
 123
45678910
11121314151617
18192021222324
252627282930  

CSS min-height pod IE

June 5th, 2007 by prond

Dość popularnym problemem przy kodowaniu layoutu na DIV’ach jest określenie minimalnej wysokości.
W prosty sposób można zdefiniować minimalną wysokość dla przeglądarek takich jak FF, czy Opera.
Jednak IEdynie słuszny ma z tym problem. Na szczęście są co najmniej 3 sposoby, aby to obejść.

/*
 *  Sposob I
 */
#content {min-height:500px;height:auto !important;height:500px;}
 
/*
 *  Sposob II
 */
#content {min-height: 500px;}
*HTML #content {height: 500px;}
 
/*
 *  Sposob III
 */
#content {height:500px}
#content[class] {height:auto; min-height:500px}

Moim faworytem jest sposób #1, ponieważ mamy tam tylko jeden selektor.
Może znacie jakieś inne, sprytniejsze ?

Posted in CSS |

2 Responses

  1. devnul Says:

    można też tak

    #content {
    min-height:500px;
    /height:auto;
    height:500px;
    }

    fakt że walidacji to nie przejdzie - ale zawsze dziala
    i jeszcze jeden sposób

    #content {
    height: expression(’500px’);
    min-height: 500px;
    }

    i też działa :)

  2. Paweł Ryznar Says:

    właśnie miałem z tym problem, i sposób #1 pomógł :) i tez myślę że to najlepsze wyjście. Jednak jest jeden problem, a może nie tyle problem co dziwna sprawa. Jeśli w danym bloku definicji stylu dam taki komentarz /*komentarz*/ to strona się sypie, natomiast jeśli dam:
    /*
    *komentarz
    */
    to wszystko jest ok. ale niestety tak to już jest z badzIEwiem ;)
    pozdrawiam :0

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.