Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Is there anyway to get the background of a web page to extend to slightly below the div tag?

Featured Replies

I've uploaded the web page I'm having trouble with to try and make it easier to understand. The problem I'm having is when you look at the page, you can see part of the grey background at the top of the page, but not at the bottom. But I want to make it so that you can see part of the grey background at the bottom of the page (like you can at the top of the page). Below is the CSS code I've created.

body	{background-color: #999;}

#wrapper	{
	margin: auto;
	padding: 0px;
	width: 1000px;
	background-color: #FFF;
}

 

Is there anyway I can do this? I know it can be done easily by adding a height property in the body section, such as:

body	{background-color: #999; height: 200px;}

The problem is I don't have a height property set on the wrapper div (so that the div expands automatically as I add content to it), so I wouldn't be able to create a set height for the body (as shown above). Is there anything else I can do?

 

Thank you for any help.

index.html

  • Author

 

 body {
background-
color: #999; 
padding-bottom:200px;
}

Thank you for your suggestion, but it doesn't seem to work.

 

Is there anyway to add an 'auto height' property, but then add an 'extension' to it? So that if the wrapper div tag is 350px in height, the background would be 400px in height (by adding an extra 50px to the auto height property of the wrapper div tag).

Edited by dandydan1152

you could always just add a extra empty div in the bottom of your wrapper with a height of 50px.

 

I think this is the easiest way

  • Author

you could always just add a extra empty div in the bottom of your wrapper with a height of 50px.

I think I might be doing something wrong, because I can't get it to work.

 

This is the CSS I have:

#expansion {
width: 1000px;
height: 50px;
background-color: #999;
}

This is how I inserted the div tag using HTML:

<div id="wrapper">
<div id="header">Header content</div>
<div id="menu">This is for the menubar</div>
<div id="text">For the text</div>
<div id="footer">This is where the footer content goes</div>
<div id="expansion"></div>
</div>

I've tried changing the 'height: 50px;' to 'min-height: 50px;', but it still doesn't work. What am I doing wrong?

 

Thank you for your help.

Edited by dandydan1152

  • Author

Thank you for your help everyone, I've sorted it now. I just inserted an image (which was just a rectangle the same colour as the background) at the bottom of the page, and it worked.

 

Thanks again everyone.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.