如何将一个新生成的div放到另一个div? [英] How to place a new generated div aside to another div?

查看:431
本文介绍了如何将一个新生成的div放到另一个div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个div,我放置一个Java Script生成的图表。另外,我得到了另一个div,其中我打印出一个带有图表数据结果的表。



一个例子是:





但是,对于UX目的我更喜欢将表放在图表的右侧。或者更多,使它出现在右边。 (我已经使用jQuery做一个 $(#resultados)。remove() $(body)append ; table ...< / table>)



如何制作图表div,标记< div id =placeholderstyle =width:1200px; height:700px>< / div> 调整大小并将其放置到右侧的另一个生成的div? p>

到目前为止,考虑已经标记的div,我尝试这个但我没有得到我想要的结果:


  1. 表格div先出现,我想要相反。 / li>
  2. 它们不会将整个外部div宽度合并。


解决方案


  1. 通过在其样式中设置 float:right $ b
  2. 使占位符div浮在左边( float:left )。

  3. 要动态更改其大小, $(#placeholder)。css({width:600px);

  4. clear:both );


I got a div where I place a Java Script generated chart. Also, I got another div where I print out a table with chart data results.

One example is:

However, for UX purposes I prefer the table to be placed on the right side of the chart. Or what's more, making it appear on the right side. (I already use jQuery to do a $("#resultados").remove() and $("body").append("<table...</table>).

How can I make the chart div, which markup is <div id="placeholder" style="width:1200px;height:700px"></div> resize down and make place to another generated div to its right side?

So far, thinking about already marked up divs I tried this but I'm not getting the results I want as:

  1. The table div appears first and I want the opposite.
  2. They don't take together the whole outer div width.

解决方案

  1. Wrap your table with a right floating div by settting float:"right" in its style.
  2. Make placeholder div to float on left (float:left).
  3. To dynamically change its size, use : $("#placeholder").css({"width":"600px");
  4. Finally , add a clear div (clear:both);

这篇关于如何将一个新生成的div放到另一个div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆