如何扩展div? [英] How to extend a div ?

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

问题描述

我有一个主div,里面有2个div,其中一个漂浮到右边

(看起来像2列)。

主div有背景图片。


我怎样才能让主div适应div的最大高度

里面的主要div为背景图像根据里面的2个div的高度,垂直重复

?这样,2个div中的一个的

内容不会与主div重叠,而是推动它的

边框。


谢谢。


-


Kerberos。

http://www.opera.com
http://www.freebsd.org
http://www.auriance.com
http:// www.osresources.com
http://exodus.jabberstudio.org

I have a main div with 2 divs inside, one of them floating to the right
(they look like 2 columns).
The main div has a background image.

How can I have the main div to adapt to the maximum height of the divs
inside of it so that the background image of the main div repeats
vertically according to the height of the 2 divs inside? This way, the
content of one of the 2 divs wouldn''t overlap the main div, but push its
border.

Thanks.

--

Kerberos.

http://www.opera.com
http://www.freebsd.org
http://www.auriance.com
http://www.osresources.com
http://exodus.jabberstudio.org

推荐答案

Kerberos写道:
Kerberos wrote:
我有一个主div,里面有2个div,其中一个漂浮到正确
(它们看起来像2列)。
主要div有背景图像。

我怎样才能有主div适应div内部的最大高度,以便主div的背景图像根据内部2个div的高度垂直重复?这样,2个div中的一个的内容不会与主div重叠,而是推动它的边界。
I have a main div with 2 divs inside, one of them floating to the right
(they look like 2 columns).
The main div has a background image.

How can I have the main div to adapt to the maximum height of the divs
inside of it so that the background image of the main div repeats
vertically according to the height of the 2 divs inside? This way, the
content of one of the 2 divs wouldn''t overlap the main div, but push
its border.




它无论如何应该做,除非你使用绝对定位。网址?


-

马克。
http://tranchant.plus.com/





你的帖子听起来像你的基本问题的第二次尝试。我担心它不是那么基本......我想了一下 - 你可能会尝试它,就像你的第一次尝试,两个div并排,给每个一个1px的边框(它给出了
a和2 px的总和)并向左移动右边的div:-1px一个像素到左边的
。然后你有一个宽度为1px的边框和长度为

更长的div。


别忘了用负数设置div保证金位置:相对,

因为IE会隐藏div的一部分。


Chris

Kerberos写道:
Hi,

your post sounds like the second try of your basic question. I fear it''s
not so basic... I thought a bit - you might try it like your first
attempt, two divs side by side, giving each a border of 1px (wich gives
a sum of 2 px) and move the right div with margin-left:-1px one pixel to
the left. Then you have a border with a width of 1px and the length of
the longer div.

Don''t forget to set the div with the negative margin position:relative,
since IE will hide a part of the div otherwise.

Chris
Kerberos wrote:
我有一个主div,里面有2个div,其中一个向右浮动
(它们看起来像2列)。
主div有一个背景图像。

如何让主div适应div内部的最大高度,以便主div的背景图像根据2的高度垂直重复div里面?这样,2个div中的一个的内容不会与主div重叠,而是推动它的边界。

谢谢。
I have a main div with 2 divs inside, one of them floating to the right
(they look like 2 columns).
The main div has a background image.

How can I have the main div to adapt to the maximum height of the divs
inside of it so that the background image of the main div repeats
vertically according to the height of the 2 divs inside? This way, the
content of one of the 2 divs wouldn''t overlap the main div, but push
its border.

Thanks.


Mark Tranchant写道:
Mark Tranchant wrote:
Kerberos写道:
Kerberos wrote:
我有一个主要的div与2 div里面,其中一个漂浮到
右边(它们看起来像2列)。
主div有一个背景图片。

我怎么能有主div到适应其内部div的最大高度,以便主div的背景图像根据内部2个div的高度垂直重复?这个方式,2个div中的一个的内容不会与主div重叠,而是推动它的边界。
I have a main div with 2 divs inside, one of them floating to the
right (they look like 2 columns).
The main div has a background image.

How can I have the main div to adapt to the maximum height of the
divs inside of it so that the background image of the main div
repeats vertically according to the height of the 2 divs inside? This
way, the content of one of the 2 divs wouldn''t overlap the main div,
but push its border.



无论如何它应该做,除非你使用绝对定位。 URL?



It should do anyway, unless you are using absolute positioning. URL?




否,Kerberos使用float。因此浮动列可能会重叠。

Kerberos:在两个列div之后,在主要div中添加一个带有'break:right'的元素。

两列div。

-

Johannes Koch

in te domine speravi;非永久性的东西。

(Te Deum,4美分。)



No, Kerberos uses float. So the floated column may overlap.
Kerberos: add an element with ''break: right'' within the main div after
the two column divs.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)


这篇关于如何扩展div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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