Css Problem mit Margin

  • Hi,
    ich bastle gerade an nem Design und wollte anstatt Tabellen mal CSS verwenden. Dazu benutze ich folgenden Code:


    Der frame-titel-spacer sollte eigentlich flexibel sein, da ich nur die margin werte angegeben habe. Wenn man sich den Code allerings mal im Webbrowser anguckt wird man merken das dass Feld nur so groß ist wie der Text kann mir jemand helfen?

  • Hi,

    Zitat von Phaeilo


    #frame-titel-spacer {margin-left: 600px; margin-right: 0px; margin-top: 0px; background-color: #FFFF00; height: 125px;}
    #frame-menu-h {position: absolute; top: 125px; left: 0px; width: 800px; height: 22px; background-color: #33CCFF;}


    Du könntest ein width-Attribut mit 100% als Wert verwenden:

    Zitat

    #frame-titel-spacer {margin-left: 600px; margin-right: 0px; margin-top: 0px; background-color: #FFFF00; height: 125px; width: 100%;}
    #frame-menu-h {position: absolute; top: 125px; left: 0px; width: 800px; height: 22px; background-color: #33CCFF;}


    Dann solltest Du aber konsequenterweise Deinen frame-menu-h ebenfalls dynamisieren:

    Zitat

    #frame-menu-h {position: absolute; top: 125px; left: 0px; width: 100%; height: 22px; background-color: #33CCFF;}


    Da Du aber mit festen Größen arbeitest, solltest du einfach Deinen frame-titel-spacer ebenso behandeln:

    Zitat

    #frame-titel {position: absolute; top: 0px; left: 0px; background-color: #FF0000; height: 125px; width: 600px;}
    #frame-titel-spacer {margin-left: 600px; margin-right: 0px; margin-top: 0px; background-color: #FFFF00; height: 125px; width: 200px;}
    #frame-menu-h {position: absolute; top: 125px; left: 0px; width: 800px; height: 22px; background-color: #33CCFF;}


    MfG
    6_freddy :)