2013-04-07 87 views
0

我正在嘗試將div對齊到右側,但只顯示底部。正確對齊一個div

Issue

CSS:

.homeWrapper{ 
    padding: 12px; 
    width:auto; 
} 
.content_inner{ 
    height: auto; 
    background-color: #6c93b8; 
    margin:12px; 
    -moz-border-radius:5px; 
    -webkit-border-radius:5px; 
    border-radius:5px; 
    clear:both; 
} 
.leftCol{ 
    display: inline-block; 
    width:448px; 
    background-color: red; 
} 
.rightCol{ 
    display: inline-block; 
    width:430px; 
    background-color: green; 
    clear:both; 
} 

HTML:

<div class="homeWrapper"> 
      <div class="content_inner"> 
       <h1><span class="color_red">Contact</span> Agrilife</h1> 
        <div class="leftCol"> 
         {{ template:body }} 
        </div> 
        <div class="rightCol"> 
         text 
         text 
         text 

        </div> 
     </div> 
    </div> 

回答

1

嘗試使用浮動

.leftCol{ 
    float:left; 
    width:448px; 
    background-color: red; 
} 
.rightCol{ 
    float:right; 
    width:430px; 
    background-color: green; 
    clear:both; 
} 
0

使用float:right;.rightCol