0

假设我有一个包含 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 我不知道如何根据屏幕尺寸缩小它...

请看一下jsfiddle 实际上我不能让 div 容纳图像所在的 2 列,而不是在左列的同一级别...

4

1 回答 1

1

为此,您也有百分比填充和边距,只需应用一些数学...

LeftDiv(padding:1% + margin:1% + width:44%) + RightDiv(padding:1% + margin:1% + width:44%) = 100%

填充和边距适用于上、下、左、右 1%、1%、1%、1%...

CSS:-

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

如果您希望图像也具有响应性,请使其width:100%;

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

于 2013-04-06T07:09:49.423 回答