Footer Background Image - Entire Page Width? - css

I have an image that I want to use as a background-image for my footer. Its sort of a gradient image, so the will be white, and the image will fade from its color, to white. It's not really a repeatable image though.
If I want it to always span the entire width of the page, is this possible without a background-repeat? Or, because of different monitor sizes, will this be impossible?
The background image I want should only be in the footer of the page. Like a sticky-footer, it should always stick to the bottom and the content will push it down as needed. It's about 400px in height.
It could still be a background (positioned bottom-center) but it can;t take up the whole height, just the width. And it need to be able to be pushed down (not fixed)

If you're comfortable using CSS3 you can use
background: #fff url(image.jpg) center center fixed no-repeat;
background-size:cover;
to have the image cover the screen. You'll want to be careful that it is at least a decent resolution though.

Related

Fitting background image to screen and positioning it to bottom

I want to apply a background image to my web page so that it covers the whole page. But the image height is bigger than the page height and I want the bottom of the image to align with the bottom of the page. Is it possible? Here's the technique I'm using so far, which doesn't make this bottom alignment:
background-image:url(background.jpg);
background-repeat:no-repeat;
background-size:cover;
I tried to add center bottom after url() but it doesn't work.
I think you can use background-position to accomplish what you want.
How to use it: http://www.w3schools.com/cssref/pr_background-position.asp

css background image doesn't repeat-x

I have a small problem on a website with a background element in CSS that doesn't go below a certain point on page. This is the link where you can see what I'm talking about, in the footer: http://www.stuffforyourdog.com/collegeadvisors/admissions.html
On other pages everything is fine, but on this one I can't figure out why the background image doesn't go all the way down, like it's supposed to.
Your background image's height is too small, if you set
.tail-top2 {
background: url(images/bg2.png) bottom repeat-x;
}
instead of top aligned, you can see that the page is too large for your image. You need to set your background image height to greater than or equal to your largest page height.

Background on fixed navigation bar not appearing

I currently have a DIV containing my fixed navigation bar in hopes to have a background image spanning across the screen behind the nav bar while the screen scrolls. However, the background isn't showing up. I tried this tip, but it didn't seem to work.
Here's my site:
http://www.whiterabbitstudio.us/
and this is the background thati's supposed to line up behind the navigation ribbon:
http://www.whiterabbitstudio.us/1images/head_bkg.png
Does anyone have any ideas? Thanks!!
It's hard to tell what you're actually trying to do, but at the moment you specified the head_bkg.png to be the background image of the <div class="header">...</div> element which has a height of 0px, thus not showing any background.
To show the background properly, I'd say you should add it to the navigation div and rework the layout of that part quite some bit, e.g. no negative margin-left, make the width 100%, center the content and add a background-size: 100%;
Besides, if you want to have the background continuous, you need to crop the image to avoid the transparent parts above and below.

Background cuts off when html and body height are set to 100%

I have my html and body set to 100% height, and a background image set on body, which gets cut off when scrolling down, as shown below.
However, YouTube has 100% height on html and body, and a background on body, and it stretches to the full height of the content. How can I achieve this?
If the only reason you put the 100% height is for the background (as one of your comments seems to suggest), then just change that to min-height: 100% and you should have no issues. You will have 100% height on short pages, but expand to as much as you need on longer pages.
You cannot extend an image unless you know the exact total height. The background image is "Extended" to the bottom. Often websites make use of an image that slowly "fades" to a solid color and then the background is set to that solid color.
Another common solution is to mark the background image as fixed so that way it doesn't scroll and thus always shows as expected.
The 100% height on the body is a scam... 8-) It generally represents 100% of the window, not the body.
A background-image will not automatically stretch to fill its container. If you want to create a 'continuous' background, you should use either the repeat-y property (which makes the image repeat vertically), set a background-position: fixed or, in the case of a solid colour, just set a coloured background.
In your case, it looks like your background is a solid colour. Might I suggest just using a plain background colour? It makes your CSS easier to read and change, and it also saves your server some bandwidth.

Strange CSS behaviour

I'm doing HTML and CSS for a site, and I've come across a very weird bug / behaviour that I can't pin down.
Take a look at http://www.atelierhsl.nl/antwerp/. There's a white line through the logo at the top. If I display:none the navigation at the bottom of the page, it disappears. But when I increase the bottom padding of the text column (.entry-content) it reappears again. This happens in Webkit, Mozilla and IE, so I know I must be doing something wrong. I just can't figure out what. Anybody?
This is caused by an anti-aliased line on the top your body's background images (just 1 pixel of light gray). The simple answer is to crop it using an image editor.
You may want to align the image to the top:
background: url("/wp-content/themes/transfer/images/bg.jpg") no-repeat scroll center top #1D1D88
The main problem is that the background image isn't as big as the the area it should cover.
Kobi's answer is correct, but if you don't mind a design suggestion: Rather than putting a black background image at no-repeat top for the body, separate body content into a container and a footer. For the content background use a smaller background image and tile it, or set the background color to black, since it appears you have no gradient. The footer div can then have a white background (inherited from the body, or just assigned directly).
You page is logically divided into main content and a footer, so the HTML should express that.
There is two solutions:
Just changed the body padding top from 60 to 40 or
changed the background position from center center to center top
I think, you should cut a 1px line from your background and to repeat-y it. There will be no bug, and you will decrease the image weight.

Resources