简体   繁体   English

如何使我的页脚背景全屏显示? (HTML / CSS网站)

[英]How do I make my footer background full screen? (HTML / CSS site)

I've been trying to solve this for a couple of hours, but I haven't found a good solution in this forum. 我已经尝试解决了几个小时,但是在这个论坛中却找不到一个好的解决方案。

So, how do I make the footer background here stretch all the way to the left and right, the way my header does? 那么,如何让我的页脚背景这里舒展一路左右,我的头的方式做?

I want the text to remain in four columns in the center of the screen with its current width (950px), but the background to fill the viewer's screen, whichever width that may be. 我希望文本以其当前宽度(950px)保留在屏幕中央的四列中,但背景要填充查看者的屏幕,无论宽度如何。

Thanks. 谢谢。

Maria 玛利亚

simple footer's table width:100%; 简单页脚表width:100%;

here is the screenshot after the change 这是更改后的屏幕截图 在此处输入图片说明

by the way container design (ex. using div) are far better than tabular design....the scope of building a beautiful site using div is larger then using tables 顺便说一下,容器设计(例如,使用div)比表格设计要好得多。...使用div构建漂亮的网站的范围要比使用表大

You need to create a div outside of the main wrapper (if you have one). 您需要在主包装器之外创建一个div(如果有的话)。

This div will be a container for your footer content. 此div将是您的页脚内容的容器。 Simply set it's width to 100%. 只需将其宽度设置为100%。

Then for the content of your footer which you want to be 950px in width, simply create another div inside the container div and assign its width to 950px and center is using margin: auto; 然后对于要设为950px的页脚内容,只需在容器div内创建另一个div并将其宽度指定为950px,并且中心使用margin:auto;

Example HTML: HTML示例:

<div id="footer-container">

  <div id="footer-content">



  </div>

</div>

CSS: CSS:

 #footer-container {
  width: 100%;  
}
#footer-content{
  width: 950px;  
  height: 80px;
  margin-left: auto;
  margin-right: auto;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM