如何让背景和页面一样长?

发布于 2024-12-25 04:08:15 字数 348 浏览 1 评论 0原文

我在更改网站时遇到了问题。页面的背景不像我放在两侧的横幅那样继续,因此该网站看起来很糟糕。你能帮我弄清楚如何将容器的背景延长到与横幅一样长(1500px)吗? 很抱歉我对问题的描述如此模糊,我在此处放置了问题网站的链接,以便您可以更好地理解我的意思。 它是 http://gentlecare.ro/index.php?route=information /information&information_id=6

非常感谢, 鸢尾花

I've encountered a problem with a website I'm changing. The background of the page does not continue like the banners I've put on the sides and the site looks horrible because of this. Could you please help me figure out how to prolong the background of the container as long as the banners( 1500px)?
I'm sorry my description of the problem is so vague, I am putting a link here to the website with the problem so you can better see what I mean.
It is http://gentlecare.ro/index.php?route=information/information&information_id=6

Thanks a lot,
Iris

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

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

发布评论

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

评论(5

凉城已无爱 2025-01-01 04:08:15

您可以使用背景大小属性。限于现代浏览器思想。您也可以仅拉伸背景图像。

You can use background-size property. Limited to modern browsers thought. You can also just strech the background image.

十秒萌定你 2025-01-01 04:08:15

您需要放在

<div style="clear:both"></div>

container-inner div 的末尾以将容器拉伸到其内容

或者更好地使用 CSS Clearfix 最佳跨浏览器解决方案

You need to put

<div style="clear:both"></div>

to the end of your container-inner div to stretch the container to it's content

Or better use CSS Clearfix Best Cross browser solution

温折酒 2025-01-01 04:08:15

您似乎有 CSS 语法错误:

    #column_left {
     float:left;
      width:230px;
      clear:; // needs to be "clear:both"
      padding:30px 0 0 10px;
                 }

it seems like you have a CSS syntax error:

    #column_left {
     float:left;
      width:230px;
      clear:; // needs to be "clear:both"
      padding:30px 0 0 10px;
                 }
掩饰不了的爱 2025-01-01 04:08:15

由于横幅具有固定的高度,因此您可以将相同的高度属性添加到 #container id 中。

#container {
width: 990px;
margin-left: auto;
margin-right: auto;
text-align: left;
background: url(../image/layout/bg-container.jpg) center 0 repeat-y;
height: 1504px;
}

Since the banners have a fixed height, you could add the same height attribute to your #container id.

#container {
width: 990px;
margin-left: auto;
margin-right: auto;
text-align: left;
background: url(../image/layout/bg-container.jpg) center 0 repeat-y;
height: 1504px;
}
活雷疯 2025-01-01 04:08:15
<div id="container-inner">
<div id="header">
<div id="column_left">
<div id="column_right"> </div>
<div id="content">
<div style="clear:both"></div>// add this
<div id="footer">
<div style="clear:both"></div>// add this
</div>

还有这个

 #container {
        background-image: url("../image/layout/bg-container.jpg");
        background-size: 990px 1518px;
    }

#footer {
    background: url("../image/layout/bg-footer.jpg") no-repeat scroll center top transparent;
    bottom: 0;
    height: 60px;
    margin: -130px 0 0;
    padding: 70px 20px 0;
    position: relative;
}
<div id="container-inner">
<div id="header">
<div id="column_left">
<div id="column_right"> </div>
<div id="content">
<div style="clear:both"></div>// add this
<div id="footer">
<div style="clear:both"></div>// add this
</div>

and this

 #container {
        background-image: url("../image/layout/bg-container.jpg");
        background-size: 990px 1518px;
    }

#footer {
    background: url("../image/layout/bg-footer.jpg") no-repeat scroll center top transparent;
    bottom: 0;
    height: 60px;
    margin: -130px 0 0;
    padding: 70px 20px 0;
    position: relative;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文