如何将div更改为响应?

时间:2015-09-22 09:18:17

标签: html5 css3

我是新手,我创造了一个div。任何人都可以建议如何将其更改为响应式视图。 代码是:

    <body>
<style>
div {
  display: inline-block;
  position: relative;
  z-index : 1;
}
div img { border: 1px red solid; display: block; }
div + img { position: absolute; z-index: 100; top: 200px; right: 600px; }
</style>
<div>
 <div>
  <img src="w2.jpg" alt="" style="height: 315px; width: 851px;" />
 </div>
 <img src="w3.jpg" alt="" style="height: 160px; width: 160px;" />
 </div>
 </body>

1 个答案:

答案 0 :(得分:0)

尝试更新的代码,例如https://jsfiddle.net/c0vpp862/

上的代码段
<div>
 <div>
  <img src="http://localhost/arp/isol_cms/wp-content/themes/twentythirteen/images/img/s5.png" alt="" style="height: 315px;" />
 </div>
 <img src="w3.jpghttp://localhost/arp/isol_cms/wp-content/themes/twentythirteen/images/img/s5.png" alt="" style="height: 160px;" />
 </div>

风格

div {
  display: inline-block;
  position: relative;
  z-index : 1;
}
div img { border: 1px red solid; display: block; }
div + img { position: absolute; z-index: 100; top: 200px; right: 600px; }

我刚删除了两个图像的宽度,如果你想要你可以设置宽度= 100%并删除图像的高度,