线框内的松弛空间。 [英] Slack space within line box.

查看:106
本文介绍了线框内的松弛空间。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个盒子里面有三个盒子的结构,如下所示:


< div class =" line">

< ; div class =" box" id =" one"> one< / div>

< div class =" box" id =" two"> two< / div>

< div class = box" id =" three"> 3< / div>

< / div>


在样式表中,我将这些块放在水平块内一行

框,这样说:


..box {display:inline;宽度:10em; }


这三个盒子没有填满收纳盒的整个宽度,

在右边留一个空格。我想做的是将

..box#3一直放在包含框的右边,并留下

左边的另外两个。你知道,比如在TeX \ hbox中使用无限的

可伸缩胶水。


而不是:


[[one] [two] [three] ..........]


我想要这个:


[[one] [two] .......... [three]]

使用绝对定位.box#3不是一个选项,因为

然后忽略它的高度。我仍然希望在所有这三个元素上计算整个盒子的高度

。有时候第三个盒子里面有额外的材料:文字包裹着几行。如果在行高计算中忽略了

,则该框与下面的下一个

行框重叠。


浮动没有'好像做了这个工作。虽然[三]将转移到

右边,但它的位置不尽可能高,所以看起来好像

这个:


[[one] [two] .................

............... .......... [三]]


理想情况下,我希望能够任意设置线盒的宽度

无需调整任何其他数字。所以比如说我不想把

粘在一个固定宽度的看不见的盒子里,这样盒子

碰巧加到了包含的总宽度上框。相对

定位,只需转移[三],也不会削减它。


在资源管理器中,我甚至看不到能够控制

框的宽度。如果我设置< body>或其他元素的宽度,它们只会被忽略:
忽略:宽度动态跟随浏览器的大小调整

窗口。在那个浏览器上,我希望[三]拥有正确的位

gravity:坚持使用窗口的右边缘。元素是

绝对定位为右:0确实表现那样。


有没有办法将可伸缩的盒子归因于它自动

在一个行框内填补空白?

解决方案

Scripsit Kaz Kylheku:


我在一个盒子里面有一个包含三个盒子的结构,如下所示:



你多次提交你的问题(至少在这里和ciwahtml) 。那是

_bad_。淘气。具有破坏性。


-

Jukka K. Korpela(Yucca)
http://www.cs.tut.fi/~jkorpela/


Jukka K. Korpela写道:


Scripsit Kaz Kylheku:


我有一个包含在一个盒子里的三个盒子的结构,如下所示:



你多次提交你的问题(至少在这里和ciwahtml)。那是

_bad_。淘气。颠覆性。



我取消了ciwahtml中的帖子,因为我意识到那是关于话题的

,因为它是样式表问题,而不是HTML

问题。然后我立即在这里重新发布。


在取消

旧帖子之前,新帖子可能已到达您的服务器。

感谢您的高度热门话题和内容丰富的回复;我的

程序的布局看起来已经好了。


Jukka K. Korpela写道:


Scripsit Kaz Kylheku:


我的框中包含三个框的结构,如下所示:



你多次提交你的问题(至少在这里和ciwahtml)。那是

_bad_。淘气。颠覆性。



我意识到这篇文章并不属于HTML新闻组,所以我

取消了它。然后我在这里重新发布。取消和张贴可以相互提前比赛,也许不会达到同一套

服务器。呃,好吧。我在另一个新闻组中看到你的回复。


I have a structure of three boxes contained within a box, like this:

<div class="line">
<div class="box" id="one">one</div>
<div class="box" id="two">two</div>
<div class=box" id="three">three</div>
</div>

In the style sheet, I lay these out horizontally blocks within a line
box, say like this:

..box { display: inline; width: 10em; }

These three boxes do not fill the entire width of the containing box,
leaving a space on the right. What I would like to do is to place
..box#three all the way to the right of the containing box, and leave
the other two to the left. You know, something like using infinitely
stretchable glue in a TeX \hbox.

Instead of this:

[[ one ][ two ][ three ] .......... ]

I want this:

[[ one ][ two ] .......... [ three ]]

Using absolute positioning for .box#three is not an option, because
then its height is ignored. I still want the height of the overall box
to be calculated on all three of these elements. Sometimes box three
has extra material in it: text which wraps to several lines. If that is
ignored in the line height calculation, the box then overlaps the next
linebox below.

Floating doesn''t seem to do the job. Although [ three ] will move to
the right, it is not positioned as high as possible, so it looks like
this:

[[ one ][ two ] .................
.........................[ three ]]

Ideally, I want to be able to set the width of the line box arbitrarily
without having to adjust any other number. So for instance I don''t want
to stick in an invisible box of a fixed width such that the boxes
happen to add up to the total width of the containing box. Relative
positioning, simply shifting [ three ] over, won''t cut it either.

In Explorer I can''t even see to be able to control the width of that
box. If I set the width of <body>, or other elements, they are just
ignored: the width dynamically follows the resizing of the browser
window. On that browser, I''d like [ three ] to have right "bit
gravity": stick with the right edge of the window. Elements which are
absolutely positioned with right: 0 do behave that way.

Is there a way to attribute stretchable box such that it automatically
fills slack within a line box?

解决方案

Scripsit Kaz Kylheku:

I have a structure of three boxes contained within a box, like this:

And you multiposted your question (at least here and c.i.w.a.html). That''s
_bad_. Naughty. Disruptive.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/


Jukka K. Korpela wrote:

Scripsit Kaz Kylheku:

I have a structure of three boxes contained within a box, like this:


And you multiposted your question (at least here and c.i.w.a.html). That''s
_bad_. Naughty. Disruptive.

I canceled the posting in c.i.w.a.html, because I realized that it was
off topic there, because it''s a style sheet question, not a HTML
question. Then I immediately reposted it here.

The new post may have reached your server before the cancelation of the
old post.

Thanks for your highly topical and informative reply though; my
program''s layout looks better already.


Jukka K. Korpela wrote:

Scripsit Kaz Kylheku:

I have a structure of three boxes contained within a box, like this:


And you multiposted your question (at least here and c.i.w.a.html). That''s
_bad_. Naughty. Disruptive.

I realized that the article didn''t belong in a HTML newsgroup, so I
canceled it. Then I reposted it here. Cancelations and postings can
race ahead of each other, and perhaps not reach the same set of
servers. Ah well. I see your reply in the other newsgroup.


这篇关于线框内的松弛空间。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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