我想把5個div元素放在一起並且居中。但是,我不能讓它工作。這裏是我的代碼把div元素放在一起並居中
<div style="width:200px;margin-right:20px;">
<div class="panel panel-default text-center" style="border: 1px solid #fab05d;border-radius:0px;">
<div class="panel-heading" style="background-color:#fab05d;color:#ffffff !important;border-radius:0px;">
<h1>2017</h1>
<p style="line-height: 14pt; margin-top:3px;margin-right:25px;">EARLY BIRD*</p>
<p style="clear:both;line-height: 16pt;">GOLD PACKAGE <br>REGISTRATION**</p>
</div>
<div class="panel-body" style="padding-top:5px;">
<p style="color:#929393;font-size:15px;"><strong>$x.00 TICKET</strong></p>
<div style="display:inline-block;margin:auto;padding-top:1px;margin-top:1px;" class="text-center">
<input type="image" src="http://localhost/wordpress/wp-content/uploads/2017/03/gold_remove.png" id="gold_r" style="">
<input type="text" class="text-center" id='goldval' name="quantity" size="5" onchange="gold_change()" style="vertical-align:top;font-weight:bold;border-radius:5px;border:1px solid #929393;">
<input type="image" src="http://localhost" id="gold_a" style="">
</div>
</div>
</div>
我有他們的。它們基本相同,只是內容不同。所有5個divs都在容器液(我正在使用bootsrap)。我試圖添加display:inline-block到我的容器,但它不起作用。另外,我使用了float:left但在這種情況下,當屏幕大小發生變化時,我無法正確對齊div。我試圖使用Bootstrap網格的擴展版本,當你可以創建相等的5列時,但在這種情況下,我的div的內容會變得混亂。任何人都可以請給我一些適用於所有屏幕尺寸的解決方案嗎?謝謝
我看不到在所提供的標記5兄弟格。請提供完整的html – RahulB
@RahulB我試圖添加完整的代碼,但由於某種原因系統渲染了它的一部分。它基本上是包含5個div塊的容器。 –