Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Width of header/footer repeated image when window is shrunk

Posted on 2010-08-24
9
Medium Priority
?
392 Views
Last Modified: 2012-05-10
Hey all,

I have this interesting scenario and i'm wondering if someone could assist me since it's been something that even stumped my buddy who works in web dev.

I don't like giving out links usually so i will explain this problem using images.

My concern is when I minimize the browser below the initial width of my container; upon scrolling to the right, i notice that the repeated bg image i'm using for the header and footer are eventually stuck once i've scrolled beyond the new browsers width.

My width is set to 100%, so my css is just doing what it's told, however i'm wondering if anyone has a solution to this problem that I've seemed to had time and time again on other sites.
1.jpg
2.jpg
3.jpg
0
Comment
Question by:Arka3L
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 21

Expert Comment

by:chapmanjw
ID: 33516579
Using CSS try setting the width of HTML, BODY, and the header container to 100%.

html
{
width: 100%;
}

body
{
width: 100%;
}

#header
{
width: 100%;
}
0
 
LVL 1

Author Comment

by:Arka3L
ID: 33516958
Those are my current attributes.
0
 
LVL 44

Expert Comment

by:Chris Stanyon
ID: 33516972
Without seeing the code and debugging using FireBug, it may be a little tricky to find your problem!

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 11

Expert Comment

by:level9wizard
ID: 33520484
That is not normal browser behavior - my first thought is to ask if you have validated both your HTML and CSS using a valid DOCTYPE ? [see w3.org]

Second, this can sometimes appear if there is a containing div (often used for content) that either applies this repeating background, or has its own interfering with it.

For the repeating bg, where is it applied? The <body>, or in <html> or in another containing <div> ?
0
 
LVL 1

Author Comment

by:Arka3L
ID: 33522975
Yes, of course, i always validate my code.

The main gradient you see in the first picture is set in the body, however the header is completely separate from the container div.

My header div is by itself and spans a width of 100% with its own bg image. Below that the container begins, so they are two separate divs altogether and one is not contained in the other.

I've decided to upload my files and remove any particular wording. The footer is not included, but thats not important.
urology.zip
0
 
LVL 44

Accepted Solution

by:
Chris Stanyon earned 2000 total points
ID: 33523541
Try adding:

    min-width:900px;

to your CSS rule for #header, within style.css

#header {
	width: 100%;
	height: 132px;
	background: #fff url(../images/header_bg.gif) repeat-x top left;
	top: 0px;
	min-width:900px;
}

Open in new window

0
 
LVL 11

Expert Comment

by:level9wizard
ID: 33524722
Arka3L>>The main gradient you see in the first picture is set in the body, however the header is completely separate from the container div.


I don't really see the need to have two separate background containers for that (one in header, one in body). Just take a single 1px-wide slice as high as needs be to grab both the header menu bit and the fading gradient and repeat it on body. Then, you can define an overlaying div for the header with Background: transparent. As for the following content boxes ( the ones with "serving your health" and "Welcome to Urology") just give them a margin:0 auto; to center, and apply the background color as needed.
0
 
LVL 1

Author Closing Comment

by:Arka3L
ID: 33525683
Most of the time is the obvious solutions that work best!
0
 
LVL 11

Expert Comment

by:level9wizard
ID: 33530617
Arka3L>>Most of the time is the obvious solutions that work best!

I would test that in several browsers (Opera,Chrome,IE,FF,etc) - I have had unexpected results with min-width and min-height unless using the min-height fast hack:
http://www.dustindiaz.com/min-height-fast-hack/
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question