tutorials.de Buch-Aktion 05/2012
ERLEDIGT
NEIN
ANTWORTEN
3
ZUGRIFFE
479
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    directtel directtel ist offline Grünschnabel
    Registriert seit
    May 2011
    Beiträge
    2
    Hallo zusammen,

    ich befasse mich seit kurzem mit CSS und floatenden div Containern. Dazu möchte ich eine Seite mit mehreren Containern erstellen die an verschiedenen Stellen angeordnet sind.

    Es klappt eigentlich auch alles soweit ganz gut, nur habe ich eine Sache die ich nicht ganz verstehe. Um alle meine Container habe ich einen Rahmen-Container erstellt um alle divs zusammenzuhaben. Klappt eigentlich auch ganz gut, nur auf einmal wenn ich die letzten div-klassen festlege, rutscht der Rahmen nach oben und die letzten div's werden nicht mehr mit eingeschlossen.

    Hier mal mein Beispiel:
    HTML-Code:
    <head>
        <title><!-- Insert your title here --></title>
        <style type="text/css">
            .dtwrapper {
                border: solid 1px yellow;
                padding: 5px;
                width: 800px;
            }
            .dtheader { /* Main header of the product site */
                border: solid 1px grey;
                margin: 0px 0px 10px 0px;
            }
            .dtusr1 { /* General information for the product, applicable to all options */
                border: solid 1px blue;
                float: left;
                width: 250px;
            }
            .dtusr1:hover { /* Mouse over effect for the general information box */
                background-color: grey;
                cursor: default;
            }
            .dtusr2 {
                float: left;
                border: solid 1px red;
                width: 250px;
                margin: 0px 0px 10px 5px;
            }
            .dtusr2:hover {
                background-color: grey;
                color: white;
                cursor: default;
            }        
            .dtusr3 {
                float: left;
                border: solid 1px orange;
                width: 250px;
                margin: 0px 0px 10px 5px;
            }
            .dtusr3:hover { 
                background-color: grey;
                cursor: default;
            }        
            .dtmainproduct { /* Box for main product of the site */
                clear: both;
                border: solid 1px green;
                margin: 0px 0px 10px 0px;
            }
            .dtoptext1 { /* Optional extras for the main product if applicable */
                border: solid 1px purple;
                float: left;
                width: 250px;
                margin: 0px 0px 10px 0px;
            }
            .dtoptext2 {
                border: solid 1px black;
                float: left;
                width: 250px;
                margin: 0px 0px 10px 5px;
            }
            .dtoptext3 {
                border: solid 1px green;
                float: left;
                width: 250px;
                margin: 0px 0px 10px 5px;
            }
            .dtsubproduct1 { /* Box for sub products (e.g. Manual prefix or Autoamtich prefix on the page of lines & calls, main product is DT OneBill) */
                border: solid 1px blue;
                clear: left;
                float: left;
                min-width: 250px;
                margin: 0px 0px 10px 0px;
            }
            .dtsubproduct2 {
                border: solid 1px red;
                float: left;
                min-width: 250px;
                margin: 0px 0px 10px 5px;
            }
            .dtsubproduct3 {
                border: solid 1px black;
                float: left;
                min-width: 250px;
                margin: 0px 0px 10px 5px;            
            }        
        </style>
    </head>
    <body>
        <div class="dtwrapper">
            <div class="dtheader">This will be the header</div>
            <div class="dtusr1">dtusr1</div>
            <div class="dtusr2">No call connection charge with any of our products.<br />No call connection charge with any of our products.<br />No call connection charge with any of our products.<br /></div>
            <div class="dtusr3">dtusr3</div>
            <div class="dtmainproduct">DT OneBill - Land line rental with Direct Telecom</div>
            <div class="dtoptext1">Optional extra - Line Guard</div>
            <div class="dtoptext2">Optional extra - Uk 250</div>
            <div class="dtoptext3">Optional extra - De 250</div>
            <div class="dtsubproduct1">Manual prefix</div>
            <div class="dtsubproduct2">Automatic prefix</div>
            <div class="dtsubproduct3">Semi-automatic prefix</div>
        </div>
    </body>
    Hat da jemand von euch eine Idee warum das passiert? Mache ich etwas falsch? Benutze ich vielleicht zu viel float?

    Bin für jede Hilfe dankbar.

    Schönen Gruss
     

  2. #2
    das-schaf das-schaf ist offline Rookie
    Registriert seit
    Jul 2003
    Beiträge
    6
    Du musst zum Schluss das floaten beenden mit z.b. nem clear-div. Hier dein Quellcode mit dem Div am ende, ... kuck mal müsste gehn.
    HTML-Code:
    <head>
        <title><!-- Insert your title here --></title>
        <style type="text/css">
            .dtwrapper {
                border: solid 1px yellow;
                padding: 5px;
                width: 800px;
            }
            .dtheader { /* Main header of the product site */
                border: solid 1px grey;
                margin: 0px 0px 10px 0px;
            }
            .dtusr1 { /* General information for the product, applicable to all options */
                border: solid 1px blue;
                float: left;
                width: 250px;
            }
            .dtusr1:hover { /* Mouse over effect for the general information box */
                background-color: grey;
                cursor: default;
            }
            .dtusr2 {
                float: left;
                border: solid 1px red;
                width: 250px;
                margin: 0px 0px 10px 5px;
            }
            .dtusr2:hover {
                background-color: grey;
                color: white;
                cursor: default;
            }        
            .dtusr3 {
                float: left;
                border: solid 1px orange;
                width: 250px;
                margin: 0px 0px 10px 5px;
            }
            .dtusr3:hover { 
                background-color: grey;
                cursor: default;
            }        
            .dtmainproduct { /* Box for main product of the site */
                clear: both;
                border: solid 1px green;
                margin: 0px 0px 10px 0px;
            }
            .dtoptext1 { /* Optional extras for the main product if applicable */
                border: solid 1px purple;
                float: left;
                width: 250px;
                margin: 0px 0px 10px 0px;
            }
            .dtoptext2 {
                border: solid 1px black;
                float: left;
                width: 250px;
                margin: 0px 0px 10px 5px;
            }
            .dtoptext3 {
                border: solid 1px green;
                float: left;
                width: 250px;
                margin: 0px 0px 10px 5px;
            }
            .dtsubproduct1 { /* Box for sub products (e.g. Manual prefix or Autoamtich prefix on the page of lines & calls, main product is DT OneBill) */
                border: solid 1px blue;
                clear: left;
                float: left;
                min-width: 250px;
                margin: 0px 0px 10px 0px;
            }
            .dtsubproduct2 {
                border: solid 1px red;
                float: left;
                min-width: 250px;
                margin: 0px 0px 10px 5px;
            }
            .dtsubproduct3 {
                border: solid 1px black;
                float: left;
                min-width: 250px;
                margin: 0px 0px 10px 5px;            
            }        
        </style>
    </head>
    <body>
        <div class="dtwrapper">
            <div class="dtheader">This will be the header</div>
            <div class="dtusr1">dtusr1</div>
            <div class="dtusr2">No call connection charge with any of our products.<br />No call connection charge with any of our products.<br />No call connection charge with any of our products.<br /></div>
            <div class="dtusr3">dtusr3</div>
            <div class="dtmainproduct">DT OneBill - Land line rental with Direct Telecom</div>
            <div class="dtoptext1">Optional extra - Line Guard</div>
            <div class="dtoptext2">Optional extra - Uk 250</div>
            <div class="dtoptext3">Optional extra - De 250</div>
            <div class="dtsubproduct1">Manual prefix</div>
            <div class="dtsubproduct2">Automatic prefix</div>
            <div class="dtsubproduct3">Semi-automatic prefix</div>
            <div style="clear: both"></div>
        </div>
    </body>
    Grüße,
    Tobi
     
    » forward-media.de | Medienagentur in Bamberg für Drupal, Prestashop und SEO - Drupal Entwicklung | Drupal Tutorials

  3. #3
    directtel directtel ist offline Grünschnabel
    Registriert seit
    May 2011
    Beiträge
    2
    Hallo Tobi,

    super das hat geklappt.

    Das bedeutet dann, dass man floatende Elemente immer clearen muss und wenn kein weiterer Container mehr kommt, dann einfach einen einfügen?

    Vielen Dank für deine Hilfe
     

  4. #4
    das-schaf das-schaf ist offline Rookie
    Registriert seit
    Jul 2003
    Beiträge
    6
    Japp, so schauts aus

    tobi
     
    » forward-media.de | Medienagentur in Bamberg für Drupal, Prestashop und SEO - Drupal Entwicklung | Drupal Tutorials

Ähnliche Themen

  1. Antworten: 3
    Letzter Beitrag: 20.11.09, 19:10
  2. Antworten: 4
    Letzter Beitrag: 18.08.08, 11:31
  3. Antworten: 0
    Letzter Beitrag: 19.04.08, 09:57
  4. Antworten: 4
    Letzter Beitrag: 21.02.08, 19:50
  5. Floatende Box
    Von buddha im Forum CSS
    Antworten: 11
    Letzter Beitrag: 27.08.07, 12:53