如何使响应div持有2 div在右边和左边的图像取决于屏幕大小



假设我有一个包含2个div的div,

是否有办法使其响应取决于屏幕大小?我想把这个应用到移动版本,但是我搞砸了…

<div id="primary">
<div id="left"><div id="object1" align='justify'>
<br/><br/>
<p>
If you told me this was a computer generated image of a mothership hovering over a planet's surface, I would have believed you. Instead, I had to look up desmids, which turned out to be a form of green algae. I would have guessed this is a cell in the process of dividing, but it turns out that one of the characteristic features of desmids is that they're a single cell divided into two compartments. (See, even I'm learning something from this.) Desmids are so tiny that this image was taken at 100x power. The green backdrop? It's a moss.
</p>
</div></div>
<div id="right"><div id="object3">
<b><h2>title</h2></b>
<img class="align-right" alt="" src="http://cdn.arstechnica.net/wp-content/uploads/2012/10/09_Place_22047_3_Drange.jpg"  style="width:200px" /></div></div></div>   

图像和div我不知道如何减少它取决于屏幕大小…

请看一看事实上,我不能让div包含图像下面的两列并且不能在左列的同一高度。

对于这个你也有百分比填充和边距,只是应用一些数学…

LeftDiv(填充:1% +利润率:1% +宽度:44%)+ RightDiv(填充:1% +利润率:1% +宽度:44%)= 100%

上、下、左、右的Padding和margin分别为1%、1%、1%、1%…

CSS

: -

#left, #right {
    margin: 1%;
    padding: 2%;
    width: 43%;
}

如果你想让图像也响应,让它的width:100%;

http://jsfiddle.net/FgnpL/5/

最新更新