2012-09-13 27 views
1

我情況怎麼樣2格在同一行一個DIV中心和其他分區向右

      CustomerInformation        button 

上面是輸出我想

<div id="headerCustomer"> 


<h:outputText style="font-size: 18px;font-weight:bold;" value="CustomerInformation " ></h:outputText> 


<input type="button"></input> 

    </div> 

,這可能是對的CSS以上來實現。

+0

使用什麼語言? ''標記是什麼意思? –

+0

使用xmlns:h =「http://java.sun.com/jsf/html」可以使用h變量訪問html標籤。 – satish

+0

@mdepolli它不是什麼大問題我的問題是,如果我放大或縮小對齊不與其餘的內容這就是爲什麼我已經發布在這裏。 – satish

回答

1

試試這個

<div id="headerCustomer"> 
<div style="float:left; padding-left:100px;" > 
<h:outputText style="font-size: 18px;font-weight:bold;" value="CustomerInformation"> </h:outputText> 
</div> 
<div style="float:right" ><input type="button" /></div> 

+0

輸入標籤naver關閉這是

+0

謝謝sujanth,但是當我放大或縮小它不會根據我按百分比放置的其他元素移動。 – satish

+0

@satish您可以使用'%'值而不是靜態值。例如:50% – Sujanth

1

.................................

Demo

嗨,現在做到這一點很容易

因爲這樣

的CSS

#headerCustomer{ 
    background:red; 
     position:relative; 
    } 
    .cntr{ 
    font-size: 18px;font-weight:bold; 
     background:green; 
     display:block; 
     width:500px; 
     margin:0 auto 
    } 
.inbg{ 
position:absolute;top:0; right:0; 
} 

HTML

<div id="headerCustomer"> 


<h:outputText value="CustomerInformation" class="cntr">Hello the the text here</h:outputText> 


<input type="button" value="submit" class="inbg"> 

    </div> 

Demo

1

我希望您正在尋找這樣的: - http://tinkerbin.com/jLXcBKTL

HTML

<div id="headerCustomer"> 
<h:outputText value="CustomerInformation " >Customer Information</h:outputText> 
<input type="button" value="submit"></input> 
</div> 

CSS

#headerCustomer { 
background:red; 
text-align:center; 
font-size: 18px; 
font-weight:bold; 
} 
input[type=button] { 
    float: right; 
    width:100px; 
    height:20px; 
} 
相關問題