2013-08-02 16 views
6

Wie kann ich taste float nur im div-bereich?links/rechts float-taste innerhalb div

Hier ist mein Beispiel CSS und HTML ..

HTML

<div class='test'> 
    <div style='float: left;'> 
    <button>test</button> 
    </div> 
    <div style='float: right;'> 
    <button>test</button> 
    </div> 
</div> 

CSS

.test { 
    width:60%; 
    display:inline; 
    overflow: auto; 
    white-space: nowrap; 
    margin:0px auto; 
} 

oder Sie können hier Live-Probe sehen ->http://jsfiddle.net/ELAVS/

ich es will so zu sein ..

enter image description here

Antwort

12

ändern display: inline zu display: inline-block

.test { 
    width:200px; 
    display:inline-block; 
    overflow: auto; 
    white-space: nowrap; 
    margin:0px auto; 
    border:1px red solid; 
} 
+0

Dank, es funktioniert: D –

+0

yw jederzeit: D –