1

2 つの div を正確に隣り合わせにする方法を理解しようとしていますが、幅などは使用しません。

Bootstrap Responsive を使用しています。正しい div を無効にしました。ただし、左側の div にはまだ右側の div があるように見えます。

これを行う方法はありますか?

.rightinfo { /* On the right */

float:right;
padding:5px;
position:relative;
top: 0;
right: 0;
margin-left:500px; /* Any kind of margin in here doesn't work, even without width */
}

.maininfo { /* On the left */
    background:#CAD2E0;
    padding: 5px;
    width: 69%; /* Even if there's margin-left on the right div, this still overrides it and uses the whole page size if it's 100% width*/
}
4

5 に答える 5

0

このようにしてみてください

<style type="text/css">
div.item
{
 float:left;
 }
</style>
<div style="float:left" id="items-container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
于 2012-09-13T11:50:24.490 に答える
0

ブートストラップにはこれが組み込まれています。

Use your layout classes.
<div class:container>
<div class:row-fluid>
<div class: Col-md-6 >
First div
</div>
<div class: Col-md-6 >
Second div
</div>
</div>
 </div>

オフセットしたい場合は、これも実行できます。ブートストラップのドキュメントは優れています。

ブートストラップインラインブロックを使用していない場合は、あなたの友達です。

于 2014-11-07T18:44:19.310 に答える
0

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

こんにちは、white-space nowrapCSSを定義します

このように

<style type="text/css">
.someclass{
white-space:nowrap;
font-size:0;
}
.itemcss
{
display:inline-block;
vertical-align:top;
font-size:12px;
 }
</style>

HTML

<div class="someclass">
<div class="itemcss"></div>
<div class="itemcss"></div>
<div class="itemcss"></div>
</div>
于 2012-09-13T11:56:03.480 に答える
0

両方に共通のクラスを追加します。

.myfloatingdiv{

表示: インラインブロック; フロート: 左;

}

divの順序を逆にすることを忘れないでください...

myrightdiv myleftdiv

それが役に立てば幸い :)

于 2012-09-13T12:03:07.710 に答える