2013-07-19 88 views
0

我有<s:textfield>和一個div元素我想要在同一行中顯示如何才能做到這一點。如何在同一行中顯示div元素和s:textfield

<s:textfield key="dimProgram.name" required="true" maxlength="128" /> 
<div class="hide prohramNameCheck" id="floatingBarsG"> 
    <div class="blockG" id="rotateG_01"></div> 
    <div class="blockG" id="rotateG_02"></div> 
    <div class="blockG" id="rotateG_03"></div> 
    <div class="blockG" id="rotateG_04"></div> 
    <div class="blockG" id="rotateG_05"></div> 
    <div class="blockG" id="rotateG_06"></div>< 
    <div class="blockG" id="rotateG_07"></div>< 
    <div class="blockG" id="rotateG_08"></div> 
</div> 

回答

1

由於Div採取完整的行,它不會直接工作,但可以完成與表或與CSS對齊。 請參閱下面的代碼片段,同樣您可以根據自己的需要進行調整。

HTML

<div class="container"> 
    <div class="div1">Image 1</div> 
    <div class="div2">Image 2</div> 
</div> 

CSS

div.container { 
    background-color: #FF0000; 
    margin: auto; 
    width: 304px; 
} 

div.div1 { 
    border: 1px solid #000; 
    float: left; 
    width: 150px; 
} 

div.div2 { 
    border: 1px solid red; 
    float: left; 
    width: 150px; 
} 

的jsfiddle:http://jsfiddle.net/azXMN/

+0

反過來想,你可以使用設置 'DIV風格內聯' 都做到了 –