如何设置嵌套在 DIV 包装器内的 DIV 的位置和尺寸?

发布于 2024-12-16 11:25:19 字数 729 浏览 4 评论 0原文

我有以下 HTML 标记:

<div id="wrapper">
    <div id="left-div"> [Content] </div>
    <div id="top-right-div"> [Content] </div>
    <div id="bottom-right-div"> [Content] </div>
</div>

left-div 的高度大于 top-right-divbottom-right-div 的总高度。我希望 left-div 始终位于包装器的左侧,top-right-div 位于右上角,bottom-right-div 在右下角。

包装器是否也可以根据所有内部

s 的高度和宽度来调整其大小?

我尝试设置绝对、浮动、显示和溢出,但无法获得所需的结果。预先感谢

更新

jsfiddle 用例: http://jsfiddle.net/sBSfp/

I have the following HTML markup:

<div id="wrapper">
    <div id="left-div"> [Content] </div>
    <div id="top-right-div"> [Content] </div>
    <div id="bottom-right-div"> [Content] </div>
</div>

left-div has greater height than top-right-div and bottom-right-div together. I would like the left-div to be always on the left side of the wrapper, top-right-div at the top right and bottom-right-div at the bottom right.

Is it also possible for the wrapper to adjust its size depending on all the inner <div>s height and width?

I tried by setting absolute, float, display and overflow but I cannot get to the desired result. Thanks in advance

UPDATE

jsfiddle use case: http://jsfiddle.net/sBSfp/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

落花随流水 2024-12-23 11:25:19

我更新了小提琴来实现我理解你想要做的事情

http://jsfiddle.net/sBSfp/2/< /a>

如果不是所需的布局,请进一步描述。

I updated the fiddle to implement what I understnd you want to do

http://jsfiddle.net/sBSfp/2/

If it is not the desired layout please further describe it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文