[英]html - positioning element to right side
我試圖用css3制作這樣的東西,但我不知道如何將搜索按鈕定位在'結果'div的右側。 不是在標簽之后
<div id="ResultBox" style="margin-right:10px;margin-top:5px; height:90%;">
<div class="result" style="display:inline;">
<div style="height:100px; width:150px;">
Name:
<label>Mojtaba Iranpanah</label><br>
Email:
<label>00000000</label><br>
Phone Numner:
<label>00000000</label>
</div>
<div class="btn" style="float:right;">
<button>Search!</button>
</div>
</div>
</div>
用這個 :
<div id="ResultBox" style="margin-right:10px;margin-top:5px; height:90%;">
<div class="result" style="display:inline;">
<div style="height:100px; width:150px; display:inline-block; float:left;">
Name:
<label>Mojtaba Iranpanah</label><br>
Email:
<label>00000000</label><br>
Phone Numner:
<label>00000000</label>
</div>
<div class="btn" style="float:right;display:inline-block;">
<button>Search!</button>
</div>
</div>
</div>
演示: http : //jsfiddle.net/DZPEy/
這應該可以解決您的問題:
<div id="ResultBox" style="margin-right:10px;margin-top:5px; height:90%;">
<div class="result" style=""> <!-- display:inline here has no effect -->
<!-- Here is the place to put the display -->
<div style="display:inline-block; height:100px; width:150px;">Name:
<label>Mojtaba Iranpanah</label>
<br>Email:
<label>00000000</label>
<br>Phone Numner:
<label>00000000</label>
</div>
<!-- Here is the place to put the display -->
<div class="btn" style="display:inline-block; vertical-align: middle; height: 100px;">
<button>Search!</button>
</div>
</div>
</div>
演示: http : //jsfiddle.net/t92c2/2/
嘗試如下:
<div id="ResultBox" style="margin-right:10px;margin-top:5px; height:90%;">
<div class="result" style="display:inline;">
<div style="height:100px; width:150px; float:left">
Name:
<label>Mojtaba Iranpanah</label><br>
Email:
<label>00000000</label><br>
Phone Numner:
<label>00000000</label>
</div>
<div class="btn" style="float:left; margin-left:10px">
<button>Search!</button>
</div>
</div>
</div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.