gpt4 book ai didi

css - 将一个 div 从固定宽度的 div 中分离出来,变成 100% 宽

转载 作者:行者123 更新时间:2023-11-28 04:19:52 25 4
gpt4 key购买 nike

this page ,我希望 div.bouble_shaded_bg_full-width 成为浏览器宽度的 100%。

我已经尝试了以下 CSS,但这不能正常工作,将 div 推到页面的一侧:

.bouble_shaded_bg_full-width {
margin-left: calc(((100%-1140px)/2)*(-1));
margin-right: calc(((100%-1140px)/2)*(-1));
}

主要内容区域的宽度为 1140 像素。

如果 div.bouble_shaded_bg_full-width 包含在固定宽度的 div 中,如何使它成为浏览器宽度的 100%?

最佳答案

下面应该这样做,删除您当前的右/左页边距。

.bouble_shaded_bg_full-width {
width:100vw;
position:relative;
left:50%;
margin-left:-50vw;
}

关于css - 将一个 div 从固定宽度的 div 中分离出来,变成 100% 宽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42265305/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com