无法让侧边栏扩展到父容器

发布于 2024-12-14 23:19:59 字数 271 浏览 2 评论 0原文

this 小提琴所示,我无法获取 customer-sidebar 那个左侧为黄色,可扩展到右侧 div 的高度。我的 main-content div 位于右侧,它有一些发货,这些发货可能会有所不同,因此我希望侧边栏扩展到相同的高度,否则它们的长度将不均匀。我尝试了“明确修复”解决方案,但它似乎对我不起作用。有人可以告诉我为什么它不起作用以及如何修复它吗?

As illustrated in this fiddle, i can't get the customer-sidebar the one in yellow on the left to expand to the height of the div on the right. I have the main-content div on the right and it has some shipments, these shipments could vary and hence i want the sidebar to expand to the same height otherwise they will be of uneven length. I tried the "clear fix" solution but it doesn't seem to be working for me. Can someone give me a pointer as to why it's not working and how to fix it ?

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

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

发布评论

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

评论(2

梦毁影碎の 2024-12-21 23:19:59

您应该将它们一个放在另一个中,并将最长的一个放在最短的一个中。

如果客户侧边栏一定是最短的,请将主要内容侧边栏放在其中。

结构应该是:

<div id="wrapper">
    <div id="shorter-box-with-yellow-bg">
        <div id="container-box-for-shorter-list"> //floats left
        </div>
        <div id="longer-box-with-blue-bg"> //floats right
             <div id="container-box-for-longer-list">
             </div>
        </div>
    </div>
 </div>

You should place them one in another, and place the longest one in the shortest one.

If the customer-sidebar is bound to be the shortest, place the main-content sidebar inside it.

The structure should be :

<div id="wrapper">
    <div id="shorter-box-with-yellow-bg">
        <div id="container-box-for-shorter-list"> //floats left
        </div>
        <div id="longer-box-with-blue-bg"> //floats right
             <div id="container-box-for-longer-list">
             </div>
        </div>
    </div>
 </div>
ぃ双果 2024-12-21 23:19:59

一种方法是创建一个 1 像素高、1000 像素宽的图像[“页面包装”的宽度],横跨侧边栏和活动货件,并将图像设置为页面包装内的背景,这称为“人造”柱技术。

您可以截取页面的屏幕截图并使用截图工具来获取您需要的图像。

One way would be to create an image 1 pixel high and 1000px wide [the width of your "page wrapper"] spanning across both the side bar and the active shipment and set the image as a background within the page wrapper this is called the faux column technique.

You can take a screen shot of the page and use a snipping tool to get the image you need.

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